This topic contains some hints on using DLLs efficiently. Effective
use of DLLs may improve the performance of your application.
- If you are using a particular DLL frequently across multiple address
spaces, the DLL can be installed in the LPA or ELPA. When the DLL
resides in a PDSE, the dynamic LPA services should be used. Installing
in the LPA/ELPA may give you the performance benefits of a single
rather than multiple load of the DLL.
- Group external variables into one external structure.
- When using z/OS UNIX avoid unnecessary load attempts.
Language Environment supports
loading a DLL residing in the z/OS UNIX file system or a data set. However,
the location from which it tries to load the DLL first varies depending
whether your application runs with the runtime option POSIX(ON) or POSIX(OFF).
If
your application runs with
POSIX(ON),
Language Environment tries to load
the DLL from the
z/OS UNIX file system first. If your DLL is a data set
member, you can avoid searching the directories. To direct a DLL
search to a data set, prefix the DLL name with two slashes (//) as
is in the following example:
//MYDLL
If your application
runs with
POSIX(OFF),
Language Environment tries to load your DLL from
a data set. If your DLL is a
z/OS UNIX file, you can avoid searching a
data set. To direct a DLL search to the
z/OS UNIX file system, prefix
the DLL name with a period and slash (./) as is done in the following
example.
./mydll
Note: DLL names are case
sensitive in the z/OS UNIX file system. If you specify the wrong case
for your DLL that resides in the z/OS UNIX file system, it will not be
found.
- For C/C++ IPA, you should only export subprograms (functions
and C++ methods) or variables that you need for the interface to
the final DLL. If you export subprograms or variables unnecessarily
(for example, by using the EXPORTALL option), you severely
limit IPA optimization. In this case, global variable coalescing
and pruning of unreachable or 100% inlined code does not occur. To
be processed by IPA, DLLs must contain at least one subprogram. Attempts
to process a data-only DLL will result in a compilation error.
- The suboption NOCALLBACKANY of the C compiler option DLL is more
efficient than the CALLBACKANY suboption. The CALLBACKANY option calls
a Language Environment routine at runtime. This runtime service enables direct function
calls. Direct function calls are function calls through function
pointers that point to actual function entry points rather than function
descriptors. The use of CALLBACKANY will result in extra overhead
at every occurrence of a call through a function pointer. This is
unnecessary if the calls are not direct function calls.