Calling C from Factor
Factor handbook > C library interface

Prev:Loading native libraries
Next:Calling Factor from C


The easiest way to call into a C library is to define bindings using a pair of parsing words:
LIBRARY:

FUNCTION:

FUNCTION-ALIAS:


The above parsing words create word definitions which call a lower-level word; you can use it directly, too:
alien-invoke ( args... return library function parameters varargs? -- return... )


Sometimes it is necessary to invoke a C function pointer, rather than a named C function:
alien-indirect ( args... funcptr return parameters abi -- return... )


There are some details concerning the conversion of Factor objects to C values, and vice versa. See Passing data between Factor and C.