DLL Programmer's Guide for TNS/R Systems
Advanced DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems—522203-002
5-5
Controlling Which Symbols Your Loadfile Exports
supplied main program. Therefore, the -e command is rarely needed. (See also ,
CRTLMAIN and CCPPMAIN Files, on page 6-17)
In a program, the procedure having the main attribute is the default entry point for
starting the program, and it usually a mistake for you to force a program to start at
some other point. The linker will not accept a program in which there are more than
one procedure having a main attribute, unless you insert the
-allow_multiple_mains option. In this case, if there are two main procedures you
must resolve the choice by inserting the -e entrypoint option.
The linker will not accept a DLL with a procedure having the main attribute; You can
force a DLL to have an entry point by inserting the -e entrypoint option when
linking that DLL, but the loader ignores it.
Controlling Which Symbols Your Loadfile Exports
Symbols offered for export are those made available to other loadfiles. By default, the
linker offers for export those symbols designated by the compiler to be exported. If you
insert the -export_all option, the linker offers all defined global symbols except for
the following:
•
Special initialization, construction, destruction, and termination procedures with
reserved name prefixes (_INIT_, _sti_, _std_, _TERM_).
•
Symbols that the linker creates, only for use within the current loadfile.
The linker interprets the option -ul as synonymous with the combination of the -dll
(or -shared) option and the -export_all option. As the option name -ul
suggests, it is often convenient, but not necessary, to use this option when linking a
user library. This option can be used when linking any DLL.
To assure that a particular symbol is unconditionally offered for export, insert the
-export symbolname option. To assure that a symbol is unconditionally not offered,
insert the -export_not symbolname option.
C++ Mangled Symbol Names
In order to identify to the linker a C++ function (other than one declared with extern
“c”), you must use the symbol’s mangled name. The linker does not make the
correspondence between unmangled and mangled names. For example, if
symbolname or entrypoint in the two previous subsections are in a C++ program,
these values must be the mangled version of their source-code names.
How to Set Run-Time Attributes of Your Loadfile
At link time, the linker sets to default values certain run-time attributes of the loadfile it
is building, unless you override a default by inserting the -set attribute value
option. See also Default Setting and Checking of File Attributes on page 2-18. Each
-set attribute option can affect only one attribute, so this option must be re-
inserted for each attribute that is changed. Permitted attributes are shown in bold in