


You may call subroutines located in dynamic link libraries (DLLs) to access native code routines without relinking the runtime system.
To use a routine located in a DLL, you must first load, or CALL, the DLL. For example, to load the dynamic link library "MYLIB.DLL", you would CALL either "MYLIB.DLL" or simply "MYLIB". The runtime automatically appends ".DLL" when searching for a DLL. The runtime searches for DLLs after it has searched for COBOL programs.
The CALL statement that loads a DLL simply makes the routines contained in the DLL available to the COBOL program. The one exception to this is if the DLL contains a routine whose name is the same as the DLL. In this case, the routine is immediately called. For example, if the DLL "MYLIB.DLL" contained a routine called "MYLIB", then
CALL "MYLIB"
would both load the DLL and execute the MYLIB routine. To load the library and avoid calling the subroutine of the same name, specify ".DLL" explicitly in the CALL statement, as shown below:
CALL "MYLIB.DLL"
Once the library has been loaded, all of the routines it contains can be called. Loaded DLLs are searched immediately prior to searching for COBOL programs on disk. Routines contained in a DLL are called using either the direct C interface or the Pascal interface. As a result, you may pass parameters BY VALUE if that is required by the routine.
When you CANCEL a DLL, you may no longer call its component libraries. This action does release a small amount of memory.