mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-06-10 03:09:31 +00:00
Merge 5763c25043cc2ee31449ffe8717c4dad81512776 into 2e9a7683f0e180bf112135fae3a3803eed8490d4
This commit is contained in:
commit
a5cd66da43
@ -146,7 +146,8 @@ proc onRetrievalHint(ctx: ptr SdsContext): RetrievalHintProvider =
|
||||
|
||||
# Every Nim library must have this function called - the name is derived from
|
||||
# the `--nimMainPrefix` command line option
|
||||
proc libsdsNimMain() {.importc.}
|
||||
when isMainModule:
|
||||
proc libsdsNimMain() {.importc.}
|
||||
|
||||
# To control when the library has been initialized
|
||||
var initialized: Atomic[bool]
|
||||
@ -163,7 +164,8 @@ proc initializeLibrary() {.exported.} =
|
||||
if not initialized.exchange(true):
|
||||
## Every Nim library needs to call `<yourprefix>NimMain` once exactly, to initialize the Nim runtime.
|
||||
## Being `<yourprefix>` the value given in the optional compilation flag --nimMainPrefix:yourprefix
|
||||
libsdsNimMain()
|
||||
when isMainModule:
|
||||
libsdsNimMain()
|
||||
ctxPoolLock.initLock() # ensure the lock is initialized once (fix Windows crash)
|
||||
when declared(setupForeignThreadGc):
|
||||
setupForeignThreadGc()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user