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.

C-Extensions are implemented with shared libraries, that will be loaded by the fglrun program on demand.

Function parameters and returned values are passed/returned on the runtime stack, using pop/push functions. Be sure to pop and push the exact number of parameters/returns expected by the caller; otherwise, a fatal stack error will be raised at runtime.

Inside the C-Extension, you can manipulate 4GL-specific data types with the C API functions supported by the language. For example, you can do DECIMAL computation.

In order to use a C-Extension in your program, you typically specify the library name with the IMPORT instruction at the beginning of the module calling the C-Extension functions. The compiler can then check for function existence and the library will be automatically loaded at runtime.

Note: