Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Feb 8, 2021
1 parent ea9fa9c commit 2319d0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/cgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,9 @@ proc genMainProc(m: BModule) =
"$1" &
"}$N$N"


NimMainProc =
# "N_CDECL(void, NimMain)(void) {$N" &
"N_LIB_PRIVATE N_CDECL(void, NimMain)(void) /*zook1*/ {$N" &
"N_LIB_WEAK N_CDECL(void, NimMain)(void) /*zook1*/ {$N" &
"\tvoid (*volatile inner)(void);$N" &
"$4" &
"\tinner = NimMainInner;$N" &
Expand Down
6 changes: 6 additions & 0 deletions lib/nimbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,18 @@ __AVR__
#endif

#if defined(WIN32) || defined(_WIN32) /* only Windows has this mess... */

# ifdef NIM_nimLinkerWeakSymbols
// semantics differ a bit from __attribute__((weak)),
// see https://stackoverflow.com/questions/2290587/gcc-style-weak-linking-in-visual-studio
// for alternative based on `/alternatename:` if this isn't enough.
# define N_LIB_WEAK __declspec(selectany)
# define N_LIB_PRIVATE
# else
# define N_LIB_WEAK
# define N_LIB_PRIVATE
# endif

# define N_CDECL(rettype, name) rettype __cdecl name
# define N_STDCALL(rettype, name) rettype __stdcall name
# define N_SYSCALL(rettype, name) rettype __syscall name
Expand Down Expand Up @@ -208,8 +212,10 @@ __AVR__
// # define N_LIB_PRIVATE __attribute__((visibility("hidden"))) __attribute__((weak))
// # define N_LIB_PRIVATE __attribute__((weak))
# ifdef NIM_nimLinkerWeakSymbols
# define N_LIB_WEAK __attribute__((weak))
# define N_LIB_PRIVATE __attribute__((weak)) __attribute__((visibility("hidden")))
# else
# define N_LIB_WEAK
# define N_LIB_PRIVATE __attribute__((visibility("hidden")))
# endif
# if defined(__GNUC__)
Expand Down

0 comments on commit 2319d0f

Please sign in to comment.