FixNative Documentation

Back to summary

import "native/native";

Global functions

function native_call(func: Pointer, sig: String[, <up to 16 parameters>]): Dynamic
function native_call_args(func: Pointer, sig: String, args: Dynamic[]): Dynamic
Calls native function. You have to provide pointer to the function as well as the signature specifying the parameters and the return value. Signature consists of a string of single letters, each specifying one parameter, return value or modifier.

It begins with optional modifiers:
$ - use STDCALL calling convention (used on Windows 32-bit only, ignored elsewhere)
+ - function uses variable number of arguments (used on ARM, ignored elsewhere)

Then the return value and the parameters follow:
v - void (used only for return values)
i - 32-bit integer (corresponds to C's int type)
l - 64-bit integer (corresponds to C's int64_t type)
n - 32/64-bit integer (corresponds to C's long type)
f - 32-bit float (corresponds to C's float type)
d - 64-bit float (corresponds to C's double type)
p - 32/64-bit pointer (corresponds to C's void * type)

Smaller integers are passed as int. Passing of 64-bit numbers is done by using two parameters, the low part and then the high part. Pointers are passed using the Pointer type. When calling functions with variable amount of arguments (varargs), remember that any floats are always passed as doubles.