mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-18 15:01:24 +00:00
fixes #2074
This commit is contained in:
@@ -84,8 +84,18 @@ when defined(windows):
|
||||
importc: "TlsAlloc", stdcall, header: "<windows.h>".}
|
||||
proc threadVarSetValue(dwTlsIndex: TThreadVarSlot, lpTlsValue: pointer) {.
|
||||
importc: "TlsSetValue", stdcall, header: "<windows.h>".}
|
||||
proc threadVarGetValue(dwTlsIndex: TThreadVarSlot): pointer {.
|
||||
proc tlsGetValue(dwTlsIndex: TThreadVarSlot): pointer {.
|
||||
importc: "TlsGetValue", stdcall, header: "<windows.h>".}
|
||||
|
||||
proc getLastError(): uint32 {.
|
||||
importc: "GetLastError", stdcall, header: "<windows.h>".}
|
||||
proc setLastError(x: uint32) {.
|
||||
importc: "SetLastError", stdcall, header: "<windows.h>".}
|
||||
|
||||
proc threadVarGetValue(dwTlsIndex: TThreadVarSlot): pointer =
|
||||
let realLastError = getLastError()
|
||||
result = tlsGetValue(dwTlsIndex)
|
||||
setLastError(realLastError)
|
||||
else:
|
||||
proc threadVarAlloc(): TThreadVarSlot {.
|
||||
importc: "TlsAlloc", stdcall, dynlib: "kernel32".}
|
||||
|
||||
Reference in New Issue
Block a user