Ox Library Development
Overview
Engine Exports
Standard Library Exports
Overview
Include Header
Building a Library
Installing a Library
Assuming you have installed Ox according to README.md:
To use the exports from the standard library:
#include <ox/std.h>
If you don't want to use the exports from the standard library:
#include <ox/engine.h>
Building a Library
The library must be built as shared library with PIC. In order to minimize the
risk of file name clashes, it is recommended to use a prefix such as
your_name. before the library name.
GCC example:
$ gcc -shared -fpic -o acme.mylib.so mylib.c
Installing a Library
Ensure the Ox library directory exists:
$ sudo mkdir -p /usr/local/lib/ox
Copy the library file to the Ox library directory:
$ sudo cp acme.mylib.so /usr/local/lib/ox
Ox libraries can also be installed in /usr/lib/ox, however
for private builds it is recommended to use /usr/local/lib/ox.
Engine Exports
gil_lock
gil_unlock
gil_lock
Locks the Global Interpreter Lock (GIL).
Declaration
void gil_lock(void);
Description
See gil_unlock.
See also
gil_unlock.
gil_unlock
Unlocks the Global Interpeter Lock (GIL).
Declaration
void gil_unlock(void);
Description
The GIL is normally always locked by the running thread. The GIL should be
temporarily unlocked when a system call that may block the thread is made so
that other threads can run. After the system call is completed, the GIL must be
immediately locked by calling gil_lock. The GIL may also be temporarily
unlocked during computations where external program values are not being
created, read or written or freed. Any program data used during such
computations must be copied to an internal buffer before the GIL is unlocked.
The GIL must be immediately locked after the computation is finished by calling
gil_lock.
See also
gil_lock.
Standard Library Exports
get_arg
get_arg
Returns a function argument.
Declaration
value_t *get_arg(call_t *call, size_t argi);
Arguments
call: Pointer to the call structure.
argi: Index of the argument to return.
Return value
The argument with index argi.
Remarks
If the parameter corresponding to the argument was declared with
PARAMETER_REFERENCE, the returned value is an l-value.