DLL Programmer's Guide for TNS/R Systems
Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems—522203-002
2-13
Re-exported libraries
Controlling Which Symbols Your Loadfile Exports on page 5-5 discusses how to 
override the automatic exporting of symbols your compiler designates as exportable.
Re-exported libraries
A DLL can also make available symbols exported by any library in its libList; that is, the 
given DLL can re-export the other library. Thus, when a given DLL, call it A, re-exports 
a library, B, any loadfile that has A in its libList can also use all the symbols offered for 
export by B. When linking a given DLL, the programmer must designate which 
libraries, if any, the given one is to re-export. 
The fact that DLL A re-exports library B is only meaningful when a loadfile that has A in 
its libList is localized, because if that loadfile is not localized, it has access to B’s 
symbols anyway.
As an example, suppose that in Figure 1-5 on page 1-12, Program is localized. Then it 
can only import symbols from User Library, A, B, and C, unless one of these four re-
exports libraries in its libList. Either B or C could re-export F, in which case Program 
could use F’s symbols. And if A re-exported either D or E, Program could use the re-
exported library’s symbols. In the latter case, if the re-exported library (either D or E) 
also re-exported G, then Program could use G’s symbols, as well. This is because re-
exportation is transitive, in that if Library X re-exports DLL Y and Y re-exports library Z, 
then X re-exports Z. User Library could also re-export H for A’s use. 
On the other hand, in Figure 1-5, if Program is globalized, then it can import symbols 
from any libraries shown in that figure, regardless of which libraries are re-exported. 
How to Make Your Loadfile Re-export Symbols of Other DLLs 
When you link your DLL, you can make it re-export the exported symbols of any library 
in its libList. To do this you insert the -reexport option, after which you insert directly 
or in a -lib option the libraries which are to be re-exported. -reexport and 
-no_reexport are a toggle-option pair telling the linker that all libraries inserted after 
the -reexport option are re-exported until the linker encounters a -no_reexport 
option. -no_reexport is the undeclared mode at the start of the command stream. 
In the following example, -reexport makes available the symbols in dllfile1 to 
any localized loadfile that has mainout in its libList. 
ld linkfile1 linkfile2 -reexport -lib dllfile1 &
-first_L pvtsvol... -dll -o mainout
Some Examples Using Re-Exportation
Splitting a DLL into Two DLLs
One use of re-exportation is to allow you to split a DLL into multiple DLLs without 
having to relink the clients of the original DLL. You might make such a split because it 
is expedient to assign responsibility for parts of the original DLL to different individuals 










