19 lines
470 B
Nim
Raw Normal View History

2019-07-07 11:38:00 +02:00
import std/os
export os
when defined(windows):
import winlean
else:
import posix
2019-05-08 14:05:16 -06:00
when not declared(getCurrentProcessId):
proc getCurrentProcessId*(): int =
## return current process ID. See also ``osproc.processID(p: Process)``.
when defined(windows):
proc GetCurrentProcessId(): DWORD {.stdcall, dynlib: "kernel32",
importc: "GetCurrentProcessId".}
2019-05-08 14:05:16 -06:00
GetCurrentProcessId().int
else:
getpid()