this workaround works but it also rely on assumption about how the codegen 
works, may not works in the future.
    
    
    when defined(vcc):
      {.emit: "N_LIB_EXPORT N_CDECL(void, NimMain)(void);".}
    else:
      proc NimMain() {.cdecl, importc.}
    
    
    proc DllMain(hModule: HANDLE, reasonForCall: DWORD, lpReserved: LPVOID): 
WINBOOL {.stdcall, exportc, dynlib.} =
      case reasonForCall
      of DLL_PROCESS_ATTACH:
        when defined(vcc):
          {.emit: "NimMain();".}
        else:
          NimMain()
      ...
    
    
    Run

Reply via email to