mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-08-07 07:23:17 +00:00
Extends the native C++ marshalling to sequences and optionals: a C++ field maps to std::vector<T> / std::optional<T>, and `toC` returns a holder that owns the C-array backing (move/NRVO-safe std::vectors) while string pointers borrow the C++ argument — valid for the call, which the library deep-copies. `fromC` reads seq/Option back out of the C-POD. Unblocks the timer's complex (seq-of-structs / seq-of-strings / two optionals) and schedule (three struct params) methods — they now generate and round-trip typed results. Verified end-to-end and ASAN-clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nim-ffi
Allows exposing Nim projects to other languages
Example
examples/timer is now a self-contained Nimble project that imports nim-ffi directly.
Use cd examples/timer && nimble install -y ../.. && nimble build to compile the example.
Description
Languages
Nim
84.1%
C++
5.9%
Smarty
5.4%
CMake
2.6%
C
2%