mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-20 16:29:31 +00:00
Adds ffi/codegen/kotlin.nim, wired into the targetLang dispatch and exposed as the `genbindings_kotlin` nimble task. From the same metadata it emits both artifacts an Android consumer needs over the native (zero-serialization) C ABI from c.nim: an idiomatic Kotlin AutoCloseable wrapper and the JNI shim that bridges it. Callback-shape selection is per proc (ack / string / struct), and the JNI shim blocks on a condvar until the FFI-thread callback fires so the Kotlin side stays synchronous. An all-string struct return crosses as a String[] that the wrapper repacks into a data class — matching the validated example. Procs needing seq/Option params, multiple struct params, or a non-string struct return are skipped with a logged notice so the generated code always compiles. That marshaling, events, and async are the next increments. 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
87.9%
Smarty
5.9%
C++
4.8%
CMake
1.4%