From 5f51c97fbd438ad48dfd8bdf4b9b6166a864da22 Mon Sep 17 00:00:00 2001 From: daan Date: Mon, 20 Jul 2020 11:27:42 -0700 Subject: [PATCH] override aligned_alloc always if using C compilation (issue #276) --- src/alloc-override.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alloc-override.c b/src/alloc-override.c index a09153c5..ae7ad7dd 100644 --- a/src/alloc-override.c +++ b/src/alloc-override.c @@ -183,7 +183,8 @@ void* _aligned_malloc(size_t alignment, size_t size) { return mi_aligne // on some glibc `aligned_alloc` is declared `static inline` so we cannot override it (e.g. Conda). This happens // when _GLIBCXX_HAVE_ALIGNED_ALLOC is not defined. However, in those cases it will use `memalign`, `posix_memalign`, // or `_aligned_malloc` and we can avoid overriding it ourselves. -#if _GLIBCXX_HAVE_ALIGNED_ALLOC +// We should always override if using C compilation. (issue #276) +#if _GLIBCXX_HAVE_ALIGNED_ALLOC || !defined(__cplusplus) void* aligned_alloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); } #endif