Binding your code

When creating a DLL, the binder automatically creates a definition side-deck that describes the functions and the variables that can be imported by DLL applications. You must provide the generated definition side-deck to all users of the DLL. Any DLL application that implicitly loads the DLL must include the definition side-deck when they bind. For information about creating a side-deck, refer to "Binding z/OS XL C/C++ programs" in z/OS XL C/C++ User's Guide.

Note: You can choose to store your DLL in a PDS load library, but only if it is non-XPLINK. Otherwise, it must be stored in a PDSE load library or in the UNIX file system. To target a PDS load library, prelink and link your code rather than using the binder. For information on prelinking and linking, see Prelinker and linkage editor options in z/OS XL C/C++ User's Guide.
When binding the C object module as shown in Figure 1, the binder generates the following definition side-deck:
IMPORT CODE,BASICIO,'bopen'
IMPORT CODE,BASICIO,'bclose'
IMPORT CODE,BASICIO,'bread'
IMPORT CODE,BASICIO,'bwrite'
IMPORT DATA,BASICIO,'berror'
Note: You should also provide a header file containing the prototypes for exported functions and external variable declarations for exported variables.
When binding the C++ object modules shown in Figure 1, the binder generates the following definition side-deck.
IMPORT CODE,TRIANGLE,'getarea__8triangleFv'
IMPORT CODE,TRIANGLE,'getperim__8triangleFv'
IMPORT CODE,TRIANGLE,'__ct__8triangleFv'

You can edit the definition side-deck to remove any functions and variables that you do not want to export. You must maintain the file as a binary file with fixed format and a record length of 80 bytes. Also, use proper binder continuation rules if the IMPORT statement spans multiple lines, and you change the length of the statement. In the above example, if you do not want to expose getperim(), remove the control statement IMPORT CODE,TRIANGLE,'getperim__8triangleFv' from the definition side-deck.

Notes:
  1. Removing functions and variables from the definition side-deck does not minimize the performance impact caused by specifying the EXPORTALL compiler option.
  2. Editing the side-deck is not recommended. If the DLL name needs to be changed, you should bind using the appropriate name. Instead of using the EXPORTALL compiler option, you should remove unnecessary IMPORT statements by using explicit #pragma export statements or _Export directives.

The definition side-deck contains mangled names of exported C++ functions, such as getarea__8triangleFv. To find the original function or variable name in your source module, review the compiler listing, the binder map, or use the CXXFILT utility, if you do not have access to the listings. This will permit you to see both the mangled and demangled names. For more information, see filter utility in z/OS XL C/C++ User's Guide.