Commit a8c8ac81

a8c8ac8156dcMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 19 files · +16 added · ~3 modified

Description

Merge pull request #245 from rramsden/introduce-ffi-feat

feat(codegen) Foreign function interface for calling C libraries

Details

Commit
a8c8ac8156dc
Parent
59a71e89659c
Merge parent
5f5f2fdbf572

README.mdmodifiedView file

@@ -209,6 +209,15 @@
209209 **I/O**: `puts`, `print`, `printf`, `p`, `gets`, `ARGV`, `ENV[]`,
210210 `File.read/write/open` (with blocks), `system()`, backtick.
211211
212+**FFI**: Direct C calls without an extension compiler. Declarations
213+(`ffi_func`, `ffi_lib`, `ffi_const`, `ffi_buffer`, `ffi_read_*`) live
214+inside a `module` body; the codegen emits externs and the `spinel`
215+wrapper picks up `-l` flags from marker comments. Scalars, strings,
216+opaque `:ptr`, integer constants, raw byte buffers, and struct-field
217+reads are covered. See [docs/FFI.md](docs/FFI.md) for the full spec
218+and [examples/ffi/](examples/ffi/) for runnable demos against libc/
219+libm and sqlite3.
220+
212221 ## Optimizations
213222
214223 Whole-program type inference drives several compile-time optimizations: