Gensym provides the Overlay utility specifically for use with foreign functions. The utility takes the template file as an input file and outputs a C source file, called an overlay file, which marshals the arguments and return types for use by G2. The Overlay utility resides in the
\ext subdirectory of the G2 product directory.Gensym also provides the
foreign.h and the icp.h header files, and the libforgn.lib library, which are all used by the makefile as part of compiling and linking the files. In conjunction with using the Overlay utility, Gensym also provides a platform-specific makefile, also located in the
ext subdirectory. The makefile calls the Overlay utility, and compiles and links the files you need to create the foreign image.
If you are building the example foreign image with the files Gensym provides, edit the makefile as the preceding table describes.
Note: The name that you provide for the executable foreign image must have a suffix of .fgn so that G2 can locate it in your directory. In the sample makefile, the file name is fgntest.fgn.
Running the Makefile
Run the Gensym makefile as you would any other makefile on your platform. Using the Overlay Utility on OpenVMS
To use the makefile to run the Overlay utility on OpenVMS, you must first define an overlay symbol as follows:
$ overlay = "$my$dev:[my.directory]overlay.exe"
$ overlay fgntest.tpl fgnover.c
foreign-code-file
generated-overlay-file
my$dev:[library.directory] libforgn.olb
libforgn.olb is the full pathname for the location of the Gensym-provided libforgn.olb library. Following is an example of such a file:
![]() |