C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling and Linking TNS/E Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
17-13
Linking a TNS/E Module
A similar initialization file for doing fault-tolerant programming, named CRTLNSE, also
might need to be linked. On OSS environment, the file is named crtlnse.o.
Dynamic-Link Libraries (DLLs)
A DLL contains code present in virtual memory at run time, to be shared by other
processes, rather than code that is linked into object files. A DLL can also contain
global data, and each process using the DLL automatically gets its own run-time copy
of the data, called instance data. A process can use several DLLs.
HP supplies public DLLs; you can create your own public DLLs.
Each process loads its public DLLs at startup from the active ZDLLnnn subvolume.
The ZDLLnnn subvolume, located on $SYSTEM, contains a version of the public DLLs
supplied by HP. A node can have more than one ZDLLnnn subvolume, but only one
active (running) ZDLLnnn subvolume.
Some code is automatically provided from the implicit libraries in the SYSnn
subvolume. The SYSnn subvolume, located on $SYSTEM, contains a version of the
operating system files for a particular node. You do not need to link code kept in the
implicit libraries.
When you use eld to build an executable program, eld fixes up references to the
DLLs that you have specified. You can also use eld to repeat the fix-up process on an
existing program to use a new version of an DLL or let the rld run-time loader or
operating system update the references when you execute the program.
To create an executable TNS/E native C or C++ program using eld:
1. Specify $SYSTEM.SYSTEM. CCPLMAIN to link to the TNS/E native C and C++
run-time library initialization object code file.
2. Specify the object code files that you compiled.
3. Specify the DLLs used by your program. For complete details, see Determining
Which DLLs are Required on page 17-14.
4. If your program uses the active backup programming functions, such as
__ns_start_backup(), specify the active backup programming support object
code file $SYSTEM.SYSTEM.CRTLNSE.
Command examples are shown in Examples
on page 17-16.
Shared Run-Time Libraries and Dynamic-Link Libraries
(DLLs)
The NonStop system implicit libraries are compatible with the use of dynamic-link
libraries (DLLs). The system implicit DLLs are public libraries in PIC (Position-
Independent Code) format.