summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-01-17 16:19:20 -0800
committerAndreas Rumpf <rumpf_a@web.de>2020-01-18 01:19:20 +0100
commitc56612ff96cf074a47222c4d9ac3db7759537afd (patch)
tree0d4545ad225b05f39f5291ebed273801b89e44cc
parent107352f9d76904d24838c9342e57fea9eba57442 (diff)
downloadNim-c56612ff96cf074a47222c4d9ac3db7759537afd.tar.gz
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
-rw-r--r--lib/nimbase.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h
index f61be7a5b..39885c70c 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