Calling DLLs from non-DLLs

It is possible to call a DLL from a COBOL program that is compiled with the NODLL option, but there are restrictions.

About this task

You can use the following methods to ensure that the DLL linkage is followed:

  • Put the COBOL DLL programs that you want to call from the COBOL non-DLL programs in the program object that contains the main program. Use static calls from the COBOL non-DLL programs to call the COBOL DLL programs.

    The COBOL DLL programs in the program object that contains the main program can call COBOL DLL programs in other DLLs.

  • Put the COBOL DLL programs in DLLs and call them from COBOL non-DLL programs with CALL function-pointer, where function-pointer is set to a function descriptor of the target program. You can obtain the address of the function descriptor for the program in the DLL by calling a C routine that uses dllload and dllqueryfn.

Example: calling DLLs from non-DLLs