Before you attempt to build complex DLLs, it is important to understand the differences between the terms DLL, DLL code, and DLL application.
A DLL (Dynamic Link Library) is a file containing executable code and data bound to a program at run time. The code and data in a DLL can be shared by several applications simultaneously. It is important to note that compiling code with the DLL option does not mean that the produced executable will be a DLL. To create a DLL, you must use the #pragma export or EXPORTALL compiler option.
A DLL application is an application that can use exported functions or variables that are bound with DLL code. All of the source files that make up a DLL application do not need to be compiled with the DLL or XPLINK option, only the source files that reference exported functions and exported global variables.
For complex DLLs and DLL applications that you compile without XPLINK, you can use the CBA suboption of the DLL|NODLL compiler option. With this suboption, a call is made, through a function pointer, to the z/OS® Language Environment®, for each function call, at run time. This call eliminates the error that would occur when a non-DLL function pointer passes a value to DLL code.
If you specify the XPLINK compiler option, the CBA and NOCBA suboptions of DLL and NODLL are ignored.
The steps for creating a complex DLL or DLL application are:
The focus of this topic is step 1 and step 2. You perform step 3 the same way you would for any other C or C++ application. Binding your code explains step 4.