SplitScript reference / Module / machExport
Module.machExport
Method
Module.machExport(name: String) -> async address!
Resolves an external function in a mapped little-endian Mach-O64 image.
Searches LC_SYMTAB, translating file-backed tables through segment commands and applying the loaded image's relocation to symbol values. Names use their exact stored spelling, including a leading underscore. Only defined external symbols in executable instruction sections are returned. Indirect, private, absolute, and undefined symbols are skipped. Command and symbol walks yield regularly and reject malformed bounds. This reads the active mapped slice, not a universal file on disk.
Parameters
name: Exact function name, at most 4096 UTF-8 bytes.
Effects: allocates, mutates the receiver, reads process memory, requires an attached process, suspends, cancels when the process closes
Runtime behavior: available in suspending attachment code; suspends; cancels when the process closes
Examples
Resolve the macOS Mono assembly enumerator
let mono = await process.module("libmonobdwgc-2.0.dylib")
let enumerator = await mono.machExport("_mono_assembly_foreach") else return