DLL Programmer's Guide for TNS/R Systems
Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems—522203-002
2-3
Choosing the Output File
where linkfile1,and linkfile2 are names of linkfiles to be combined in the link.
Choosing the Output File
The output file is where the linker stores the loadfile that results from a link. To specify
an output file name, insert the –o filename option, where filename is the desired
name of a file. For example:
ld linkfile1 linkfile2 -o mainout
This specifies that the linkfiles from the previous example are to be linked and the
output loadfile is to be stored in mainout. -o is a one-time option.
Choosing to Create a Program or a DLL
By default, the linker combines specified linkfiles to produce a loadfile that is a
program, not a DLL. Thus, the previous example will cause the linker to produce a
program that it stores in mainout. To explicitly cause the linker to produce a program,
insert the -call_shared option.
To create a DLL in mainout, insert the option -dll, or its synonym, -shared, as in
the following example.
ld linkfile1 linkfile2 -dll -o mainout
-call_shared and -dll are mutually exclusive, one-time options.
Naming DLLs
Unlike programs, every DLL has an internal name that is also the name of the file
where that DLL is (to be) stored on the execution target; see Choosing a DLL Name on
page 2-5. This name is specified when the DLL is linked and is recorded in the DLL
itself. The -dllname nameofdll option gives the DLL its internal name,
independently of the name of the file in which you store it. The -dllname option can
be used to create an arbitrary DLL name, for example, a fully qualified file name.
The following example might be used to link on a Win32 system, to give the resulting
DLL the name maindll, and to store it in a file named mainoutput.dll in a
directory named C:\myfiles\dlls.
ld linkfile1 linkfile2 -dll -dllname maindll &
-o C:\myfiles\dlls\mainoutput.dll
You also have three ways to give the DLL and its output file the same name:
•
The -o filename option, when used by itself, assigns filename to the internal
DLL name as well as the file. When using the -o option and filename is a
qualified file name, the DLL name is obtained by truncating filename to remove
the path or subvolume definition and yield the corresponding unqualified name.
See File-Name Qualification below.