Calling C Programs in DLLs or Shared Object Libraries

The simplest way to call a C program from ACUCOBOL-GT is to:

  1. Package the routine into a Windows DLL or UNIX/Linux shared object library.
  2. Load the DLL or shared object at startup by using one of the following options:
    • Use the "-y" runtime option
    • Use the SHARED_LIBRARY_LIST runtime configuration variable
    • Load the DLL or shared object during program execution with a CALL statement or via the SHARED_LIBRARY_LIST variable and a SET ENVIRONMENT statement.
  3. Call the routine with a CALL statement.

For a detailed description of using this method with DLLs, see Calling DLLs from COBOL.

This section contains detailed information on calling routines in UNIX/Linux shared objects. An important advantage of this method is that it is not necessary to relink the runtime.

In this section, we describe the following methods of loading and calling programs in shared object libraries:

Once loaded, any exported function can be called with a COBOL CALL statement.