With C-Extensions, you can bind your own C libraries in the runtime system,
to call C function from the application code.
Understanding C-Extensions
With C-Extensions, you can bind your own C libraries in the runtime system, to call C function from the application code. This feature allows you to extend the language with custom libraries, or existing standard libraries, by writing some 'wrapper functions' to interface with the Genero language.
Header files for ESQL/C typedefs
To compile C-Extensions using complex data types such as DECIMAL, DATETIME/INTERVAL or BYTE/TEXT, you need IBM® Informix® ESQL/C data type structure definitions such as dec_t, dtime_t, intrvl_t, as well as macros like DECLEN() or TU_ENCODE(). These definitions are not required if you use standard C types such as short, int or char[].
Creating C-Extensions
Custom C-Extensions must be provided to the runtime system as Shared Objects (.so) on UNIX™, and as Dynamically Loadable Libraries (.DLL) on Windows™.
Creating Informix ESQL/C Extensions
C-Extension libraries can be created from ESQL/C sources, as long as you have an Informix® ESQL/C compiler which is compatible with your Genero runtime system.
The C interface file
To make your C functions visible to the runtime system, you must define all the functions in the C interface file.
Linking programs using C-Extensions
When creating a 42r program or 42x library, the linker needs to resolve all function names, including C-Extension functions.
Loading C-Extensions at runtime
The runtime system can load several C-Extensions libraries, allowing you to properly split your libraries by defining each group of functions in separate C interface files.
Runtime stack functions
To pass values between a C function and a program, the C function and the runtime system use the runtime stack.