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®.
In order to create a C-Extension, you must:
- Setup you C compiler environment.
- Modify your C source modules by including the fglExt.h header
file:
#include "f2c/fglExt.h"
- Define the list of user functions in the C interface file, by including the fglExt.h header file.
- Compile the C sources and C interface file, the link these object files to create a shared object (.so or .DLL)
To setup the C compiler environment: On a UNIX/Linux® operating system, check the cc or gcc command. On a Windows, you need a Visual C++ version compatible with the FGL package. It is mandatory to setup the Visual C++ environment by executing the vcvars64.bat command file provided in the Visual C++ installation directory.
When migrating from IBM® Informix® 4GL, it is possible that existing C-Extension sources include Informix specific headers like sqlhdr.h or decimal.h. Replace the Informix 4GL header files by fglExt.h header file.
fglmkext -o myext.so module_a.c module_b.c
The fglmkext command line tool contains platform-specific C compiler and linker options required to build a C Extension library.