mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 07:21:19 +00:00
prevent name mangling for C++ DLLs
This commit is contained in:
@@ -67,7 +67,7 @@ __clang__
|
||||
#endif
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
|
||||
# define NIM_THREADVAR __declspec(thread)
|
||||
# define NIM_THREADVAR __declspec(thread)
|
||||
#else
|
||||
# define NIM_THREADVAR __thread
|
||||
#endif
|
||||
@@ -103,7 +103,11 @@ __clang__
|
||||
# define N_FASTCALL_PTR(rettype, name) rettype (__fastcall *name)
|
||||
# define N_SAFECALL_PTR(rettype, name) rettype (__safecall *name)
|
||||
|
||||
# define N_LIB_EXPORT extern __declspec(dllexport)
|
||||
# ifdef __cplusplus
|
||||
# define N_LIB_EXPORT extern "C" __declspec(dllexport)
|
||||
# else
|
||||
# define N_LIB_EXPORT extern __declspec(dllexport)
|
||||
# endif
|
||||
# define N_LIB_IMPORT extern __declspec(dllimport)
|
||||
#else
|
||||
# define N_CDECL(rettype, name) rettype name
|
||||
@@ -118,7 +122,11 @@ __clang__
|
||||
# define N_FASTCALL_PTR(rettype, name) rettype (*name)
|
||||
# define N_SAFECALL_PTR(rettype, name) rettype (*name)
|
||||
|
||||
# define N_LIB_EXPORT extern
|
||||
# ifdef __cplusplus
|
||||
# define N_LIB_EXPORT extern "C"
|
||||
# else
|
||||
# define N_LIB_EXPORT extern
|
||||
# endif
|
||||
# define N_LIB_IMPORT extern
|
||||
#endif
|
||||
|
||||
@@ -345,7 +353,7 @@ struct TFrame {
|
||||
#define nimln(n, file) \
|
||||
F.line = n; F.filename = file;
|
||||
|
||||
#define NIM_POSIX_INIT __attribute__((constructor))
|
||||
#define NIM_POSIX_INIT __attribute__((constructor))
|
||||
|
||||
#if defined(_MSCVER) && defined(__i386__)
|
||||
__declspec(naked) int __fastcall NimXadd(volatile int* pNum, int val) {
|
||||
@@ -380,7 +388,7 @@ static inline void GCGuard (void *ptr) { asm volatile ("" :: "X" (ptr)); }
|
||||
#endif
|
||||
|
||||
/* Test to see if Nim and the C compiler agree on the size of a pointer.
|
||||
On disagreement, your C compiler will say something like:
|
||||
On disagreement, your C compiler will say something like:
|
||||
"error: 'assert_numbits' declared as an array with a negative size" */
|
||||
typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user