Foreign function interface (FFI)

mu can call native libraries via dlopen, dlsym, and dlcall, or use the higher-level ffi.fn helper for constant bindings.

Example

import "ffi"

puts := ffi.fn("/usr/lib/libSystem.B.dylib", "puts", "i32", ["cstr"])
puts("hello from mu")

Notes

See docs/Specification.md for full FFI rules.

Next steps