mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-07-16 04:59:28 +00:00
ffiNewReq derived the request id with `let typeStr = $T`, allocating a
Nim GC string on the *calling* thread for every request. Embedded in a
foreign host (e.g. Go) the callers are transient, concurrent OS threads;
running Nim's GC there corrupts the heap under load. The type name is
known at compile time, so emit it as a `cstring` literal (the same value
already used as the registry key) — no runtime allocation. Applies to
both the {.ffi.} and {.ffiCtor.} request builders.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nim-ffi
Allows exposing Nim projects to other languages
Example
examples/nim_timer is now a self-contained Nimble project that imports nim-ffi directly.
Use cd examples/nim_timer && nimble install -y ../.. && nimble build to compile the example.
Description
Languages
Nim
84.4%
Smarty
7.3%
C++
3.4%
CMake
2.7%
C
2.2%