Logo
Explore Help
Sign In
logos-messaging/nim-ffi
1
0
Fork 0
You've already forked nim-ffi
mirror of https://github.com/logos-messaging/nim-ffi.git synced 2026-06-21 00:40:16 +00:00
Code Issues Packages Projects Releases Wiki Activity
nim-ffi/examples/timer/go_bindings/go.mod

4 lines
25 B
Modula-2
Raw Permalink Normal View History

feat(codegen): Go bindings support struct/seq/Option params The Go generator previously emitted a `// SKIPPED` stub for any proc with a struct, sequence or optional parameter, leaving Echo/Complex/Schedule uncallable. Now that the native ABI carries those as flat C-POD structs, the Go side can marshal them: emit an idiomatic Go struct per {.ffi.} type plus a `toC()` that builds the matching `C.<Type>` (C.CString for strings, a C array for seqs, present-flags for options, recursively for nested structs) and returns cleanup funcs run via defer once the call returns. The native path deep-copies every argument, so releasing the C buffers immediately is safe. The C bridge already accepted struct-by-value params via the pass-through type mapping; only the Go-side conversion and the `allSupported` gate needed work. Bare seq/Option *top-level* params (not wrapped in a struct) remain skipped, as the native ABI does not expose them either. The generated package is now self-contained: the native `<lib>.h` is emitted beside the `.go`, and the cgo directives use ${SRCDIR} so the header and the staged library resolve without extra env vars. genbindings_go runs gofmt to finalize column alignment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 11:03:15 +02:00
module my_timer
go 1.21
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.0 Page: 26ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API