nld Manual
nld Utility
nld Manual—528272-001
2-13
Linking User Libraries
If the operating system cannot find a user library or system library procedure to satisfy
a run-time external reference, it displays a message as the process starts. When the
process calls an unresolved procedure, the process changes the call to the unresolved
procedure into a call to the Debug utility or the Inspect symbolic debugger, and the
process enters the debug state.
In the TNS environment, either or both the program file and the user library can be
processed by the Accelerator. TNS user libraries can contain embedded SQL/MP
statements.
In the TNS/R environment, both the program file and the user library must be compiled
with TNS/R native compilers. TNS/R native user libraries cannot contain embedded
SQL/MP statements. Move procedures with embedded SQL/MP statements to user
code before migrating a TNS user library to a TNS/R native user library. (For more
information on migrating TNS user libraries to TNS/R native user libraries, see the
TNS/R Native Application Migration Guide.)
A TNS/R native user library can contain its own data, which is allocated for each
process, in a separate location from the client program’s data. A TNS/R native user
library can call functions in SRLs, such as the C run-time library. If a user library calls
functions in an SRL, you must specify the SRLs when linking. Do not link the
CRTLMAIN object file to a user library.
To create a TNS/R native user library:
1. Compile the procedures that you want to put in the library.
2. Use nld to link the resulting object files into a single executable user library.
Use the -o option to specify the name of the resulting object file.
Use the -ul option to specify that the resulting object file is a user library.
For example, in the Guardian environment, this command links the object files
file1 and file2 into an executable user library named lib:
nld file1 file2 -o lib -ul
This command is the OSS equivalent of the preceding command:
nld file1.o file2.o -o lib -ul
If the procedures are written in ... Compile them ...
C or C++ With the SRL pragma and
without the RUNNABLE pragma
COBOL Without the RUNNABLE directive
pTAL With the SRL pragma
Note. You can link only linkfiles into a user library. You cannot link loadfiles, or a
combination of loadfiles and linkfiles, into a user library.