Qu

native_call

Builtin index · File I/O

native_call(lib, name, signature, args...)

Input: lib, name, signature, args... · Output: no output

What it is

Calls the C function name in a load_library handle, with its C signature stated as a string, because a library does not record its argument types. Three shapes are supported: scalars, R(T, ...) with 0-6 arguments all of one type T in double/int32/int64 and R one of those or void ("double(double, double)"); an array kernel, R(double*, N) with N int32 or int64, which receives a copy of a vector and its length, void returning the modified copy ("void(double*, int32)"); and an array transform, void(double*, double*, N), input and same-length output, returning the output. Any other signature is refused before any native code runs. A wrong signature is undefined behaviour and a crash in the library ends the interpreter -- try cannot catch it. Callable as lib.native_call(...). Refused under --sandbox. Added in v0.4.3.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
native_call(lib, name, signature, args...)
lib —Callable as lib.native_call(...).
name stringCalls the C function name in a load_library handle, with its C signature stated as a string, because a library does not record its argument types.
signature stringCalls the C function name in a load_library handle, with its C signature stated as a string, because a library does not record its argument types.
args... repeatablenot documented yet
not documented yetThree shapes are supported: scalars, R(T, ...) with 0-6 arguments all of one type T in double/int32/int64 and R one of those or void ("double(double, double)"); an array kernel, R(double*, N) with N int32 or int64, which receives a copy of a vector and its length, void returning the modified copy ("void(double*, int32)"); and an array transform, void(double*, double*, N), input and same-length output, returning the output. Refused under --sandbox. Added in v0.4.3.

Examples

No documentation example calls this form yet. The File I/O chapter is where one belongs.