DLL Programmer's Guide for TNS/R Systems
Sample Sessions and Usage Notes
DLL Programmer’s Guide for TNS/R Systems—522203-002
6-5
Sample Session Two
Sample Session Two
In this session we use the same source code, but compile it as position-independent 
code (PIC) and create a DLL.
Display the Program Code
There are no changes to the source code used in Session One.
Compile the Program and Library
We use the same compiler, nmc, but select a new option, call_shared, which 
creates position independent code (PIC). 
There are three new command line options available at compile time to nmc and 
nmcplus:
non_shared
 directs the compiler to generate non-shared (not PIC) code. This is the default
call_shared
 directs the compiler to generate shared (PIC) code. If the runnable option is 
also specified, this causes the creation of a PIC executable file; otherwise it 
causes the creation of a PIC -linkable object file
shared 
directs the compiler to generate shared PIC and to invoke the linker to create a 
PIC library file (a DLL).
$SYSTEM.SYSTEM.NMC /IN mainstrc/mainstro;suppress, OPTIMIZE 0,SYMBOLS,ERRORS 
5,EXTENSIONS,call_shared
TNS/R Native Mode Risc C - T9577D46 - 30APR2003 (Mar 23 2003 19:42:26)
(C)2000 Compaq (C)2003 Hewlett Packard Development Company, L.P.
0 remarks were issued during compilation.
0 warnings were issued during compilation.
0 errors were detected during compilation.
Object file: mainstro
Compiler statistics
 phase CPU seconds elapsed time file name
 NMC \DLLQA.$SYSTEM.SYSTEM.NMC
 CFE 1.0 00:00:03 \DLLQA.$SYSTEM.SYSTEM.CFE
 UGEN 0.1 00:00:00 \DLLQA.$SYSTEM.SYSTEM.UGEN
 AS1 0.0 00:00:00 \DLLQA.$SYSTEM.SYSTEM.AS1
 total 1.0 00:00:03 
All processes executed in CPU 03 (NSR-G)
Swap volume: \DLLQA.$SYSTEM
$SYSTEM.SYSTEM.NMC /IN mystrngc/mystro;suppress, OPTIMIZE 0,SYMBOLS,ERRORS 
5,EXTENSIONS,call_shared
TNS/R Native Mode Risc C - T9577D46 - 30APR2003 (Mar 23 2003 19:42:26)
(C)2000 Compaq (C)2003 Hewlett Packard Development Company, L.P.
0 remarks were issued during compilation.










