Ivan FB b7fa33f2c7
feat(codegen): native Swift generator over the C ABI
Adds ffi/codegen/swift.nim, wired into the targetLang dispatch and exposed
as the `genbindings_swift` nimble task. It emits an idiomatic Swift wrapper
over the native (zero-serialization) C ABI from c.nim — importing the C
structs through the CMyTimer clang module and never touching CBOR.

The one piece of real logic is callback-shape selection: ack / string /
struct decoding is chosen per proc from FFIProcMeta.kind + returnTypeName,
and struct returns are copied out inside the callback to honour the
deep-free-after-callback ownership rule. A single struct param's fields are
flattened into the Swift method signature; ctors keep argument labels.

Procs needing seq/Option or multi-struct param marshaling are skipped with a
logged notice rather than emitting broken Swift, so the wrapper always
compiles. That marshaling, events, and async mapping are the next increments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 16:39:54 +02:00
2026-05-19 12:43:34 +02:00
2026-05-21 16:33:38 +02:00
2026-05-20 14:14:42 -03:00
2026-05-27 22:26:39 +02:00
2026-05-20 14:14:42 -03:00
2026-05-16 01:08:42 +02:00
2026-05-20 14:14:42 -03:00
2026-05-20 14:14:42 -03:00

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
Allows exposing Nim projects to other languages
Readme
Languages
Nim 87.9%
Smarty 5.9%
C++ 4.8%
CMake 1.4%