diff options
-rwxr-xr-x | compiler/cgen.nim | 3 | ||||
-rwxr-xr-x | compiler/pragmas.nim | 22 | ||||
-rwxr-xr-x | lib/system.nim | 1 | ||||
-rwxr-xr-x | lib/system/threads.nim | 1 |
4 files changed, 16 insertions, 11 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 8d027b11c..06018fa99 100755 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -861,7 +861,8 @@ proc genMainProc(m: BModule) = CommonMainBody & "}$n" WinCDllMain = "BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, $n" & - " LPVOID lpvReserved) {$n" & "\tNimMain();$n" & + " LPVOID lpvReserved) {$n" & + "\tif(fwdreason == DLL_PROCESS_ATTACH) NimMain();$n" & "\treturn 1;$n" & "}$n" PosixNimDllMain = WinNimDllMain PosixCDllMain = diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 28f77d1b9..fd637f4c7 100755 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -212,16 +212,22 @@ proc expectDynlibNode(c: PContext, n: PNode): PNode = result = newEmptyStrNode(n) proc processDynLib(c: PContext, n: PNode, sym: PSym) = - if (sym == nil) or (sym.kind == skModule): + if (sym == nil) or (sym.kind == skModule): POptionEntry(c.optionStack.tail).dynlib = getLib(c, libDynamic, expectDynlibNode(c, n)) - elif n.kind == nkExprColonExpr: - var lib = getLib(c, libDynamic, expectDynlibNode(c, n)) - addToLib(lib, sym) - incl(sym.loc.flags, lfDynamicLib) - else: - incl(sym.loc.flags, lfExportLib) - + else: + if n.kind == nkExprColonExpr: + var lib = getLib(c, libDynamic, expectDynlibNode(c, n)) + addToLib(lib, sym) + incl(sym.loc.flags, lfDynamicLib) + else: + incl(sym.loc.flags, lfExportLib) + # since we'll be loading the dynlib symbols dynamically, we must use + # a calling convention that doesn't introduce custom name mangling + # cdecl is the default - the use can override this explicitly + if sym.typ.callConv == ccDefault: + sym.typ.callConv = ccCDecl + proc processNote(c: PContext, n: PNode) = if (n.kind == nkExprColonExpr) and (sonsLen(n) == 2) and (n.sons[0].kind == nkBracketExpr) and diff --git a/lib/system.nim b/lib/system.nim index 84a3034f0..64a70b61b 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -1935,7 +1935,6 @@ when not defined(EcmaScript) and not defined(NimrodVM): include "system/syslocks" include "system/threads" elif not defined(nogc): - initStackBottom() initGC() proc setControlCHook*(hook: proc () {.noconv.}) diff --git a/lib/system/threads.nim b/lib/system/threads.nim index 7a60404ac..6b1fd2178 100755 --- a/lib/system/threads.nim +++ b/lib/system/threads.nim @@ -203,7 +203,6 @@ when not defined(useNimRtl): when not useStackMaskHack: var mainThread: TGcThread ThreadVarSetValue(globalsSlot, addr(mainThread)) - initStackBottom() initGC() when emulatedThreadVars: |