I guess I've found a workaround to access the library handle:
    
    
    import winim/inc/[windef, wincon, winbase]
    
    proc getCurrentModule: HINSTANCE =
      discard GetModuleHandleEx(
        GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS or
        GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
        cast[LPWSTR](getCurrentModule),
        result.addr,
      )
    
    proc mainThread =
      AllocConsole()
      discard stdout.reopen("CONOUT$", fmWrite)
      echo getCurrentModule()
      while true: discard
    
    when isMainModule:
      var t: Thread[void]
      t.createThread(mainThread)
    
    
    Run

Reply via email to