Interface: DlopenSymbol
Describes a native symbol for use with dlopen.
An entry with type declares a data symbol (a global variable); any other
entry declares a function.
The key an entry is listed under is the JS property name it binds to, and
by default also the C symbol resolved; name separates the two.
Properties
args?
optionalargs?:TypeOrAlias[]
Argument types. Defaults to [] (no arguments) if omitted.
fixed?
optionalfixed?:number
Number of fixed arguments for variadic functions.
name?
optionalname?:string
C symbol to resolve. Defaults to the key the entry is listed under.
Set it to bind one C symbol more than once — a variadic function needs a binding per arity — or to expose a C name under a friendlier one.
optional?
optionaloptional?:boolean
When true, a symbol that cannot be resolved is left out of
symbols instead of making the whole dlopen throw — use
'foo' in symbols to find out whether this build of the library has
it. Only resolution is affected; any other failure still throws.
returns?
optionalreturns?:TypeOrAlias
Return type. Defaults to 'void' if omitted.
type?
optionaltype?:TypeOrAlias
Type of a global variable. The symbol binds to a level-1
Pointer at the variable's address instead of a callable, so
symbols.foo.deref() reads it. A global with a deeper indirection is
reached by rebuilding the pointer: new Pointer(symbols.foo.addr, 2, type).
Mutually exclusive with args and returns; an entry carrying both
throws a TypeError.