mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-07-14 20:19:55 +00:00
{.ffi.}/{.ffiCtor.} cover the async, context-handle, CBOR-marshaled path.
{.ffiExport.} covers the complementary case: a no-argument lifecycle/health
entry point a host loads with dlopen+dlsym and calls synchronously — no
context, no callback, no CBOR, the return value crossing the ABI directly.
Native Nim return types are bridged to the C ABI (int/bool -> int,
uint64 -> unsigned long long, string -> const char* kept alive in shared
memory; no-return -> void), and initializeLibrary() is injected so the Nim
runtime is up on first call — the host never invokes NimMain itself.
Fills the no-argument scalar case of the declared-but-unimplemented abi=c path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138fdSv6Xhv2KjhiyYR4SAu
15 lines
472 B
Nim
15 lines
472 B
Nim
import std/[atomics, tables]
|
|
import chronos, chronicles
|
|
import
|
|
ffi/internal/[ffi_library, ffi_macro, ffi_export, c_wire],
|
|
ffi/[
|
|
alloc, ffi_types, ffi_events, ffi_handles, ffi_context, ffi_context_pool,
|
|
ffi_thread_request, cbor_serial,
|
|
]
|
|
|
|
export atomics, tables
|
|
export chronos, chronicles
|
|
export
|
|
atomics, alloc, ffi_library, ffi_macro, ffi_export, ffi_types, ffi_events, ffi_handles,
|
|
ffi_context, ffi_context_pool, ffi_thread_request, cbor_serial, c_wire
|