module ffi

module lib/ffi.mu

import "ffi"

ffi provides helpers for binding foreign functions.

Functions

fn#

fn fn(lib_path, symbol, ret, args)

fn returns a closure intended for compile-time FFI binding in native builds. In the VM, the returned closure reports a descriptive error when called.

Source lib/ffi.mu:14
fn fn(lib_path, symbol, ret, args) {
  return _build_fn(lib_path, symbol, ret, args)
}

sig#

fn sig(ret, args, abi...)

sig builds a signature map for dlcall and ffi.fn bindings.

Source lib/ffi.mu:5
fn sig(ret, args, abi...) {
  if len(abi) > 0 {
    return _build_sig(ret, args, abi[0])
  }
  return _build_sig(ret, args)
}

Internal helpers

Underscore-prefixed names are implementation detail. They are listed so the module's source reads without surprises, not as API — they may change at any time.

_build_fn(_, _, _, _)
_build_sig(ret, args, abi...)