From c56612ff96cf074a47222c4d9ac3db7759537afd Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 17 Jan 2020 16:19:20 -0800 Subject: [PATCH] refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.} (#13136) * refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.} * put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc --- lib/nimbase.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/nimbase.h b/lib/nimbase.h index f61be7a5bc4f..39885c70cdeb 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -159,7 +159,13 @@ __AVR__ # define NIM_CAST(type, ptr) ((type)(ptr)) #endif + /* ------------------------------------------------------------------- */ +#ifdef __cplusplus +# define NIM_EXTERNC extern "C" +#else +# define NIM_EXTERNC +#endif #if defined(WIN32) || defined(_WIN32) /* only Windows has this mess... */ # define N_LIB_PRIVATE @@ -208,11 +214,7 @@ __AVR__ # define N_FASTCALL_PTR(rettype, name) rettype (*name) # define N_SAFECALL_PTR(rettype, name) rettype (*name) # endif -# ifdef __cplusplus -# define N_LIB_EXPORT extern "C" -# else -# define N_LIB_EXPORT extern -# endif +# define N_LIB_EXPORT NIM_EXTERNC __attribute__((visibility("default"))) # define N_LIB_IMPORT extern #endif @@ -520,12 +522,6 @@ typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == siz } #endif -#ifdef __cplusplus -# define NIM_EXTERNC extern "C" -#else -# define NIM_EXTERNC -#endif - #if defined(_MSC_VER) # define NIM_ALIGN(x) __declspec(align(x)) #else