Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

OSS environment. More information about using size is available in the size(1) online
reference page; size is not available in the OSS environment.
strip removes the symbolic debugging information and symbol tables from an object file,
reducing the amount of space taken on a disk. More information about using strip is
available in the strip(1) online reference page; strip is also available in the OSS
environment.
If you manage your disk usage on the workstation using strip, then you can manage your
disk usage in the OSS environment using strip. Note that strip should not be used in the
OSS environment until all debugging work has been completed.
Linkable Library Routines
The final phase of compiling is the linking of the object files that you have compiled with standard
library routines. There are system-standard library routines, as well as private library routines, that
you can link into your programs. Your UNIX workstation might use a separate linker for this task,
or your C compiler might provide linking services.
The HP C compiler also provides linking services, or you can use the nld, ld, or eld linker if you
prefer.
Most UNIX C compilers support both dynamic and static linking. Dynamic linking implies shared
library objects are loaded at execution time. (Static linking includes library modules in the executable
program at compile time.) On a UNIX workstation, the standard C library /usr/lib/libc.so
is searched by default for dynamic library modules.
The OSS environment also supports both static and dynamic linking. Static linking of SRLs is
performed by the nld utility. A dynamic linking capability is provided by the ld utility (for TNS/R
PIC object files) and the eld utility (for TNS/E object files). ld and eld create dynamic-link libraries
(DLLs), which can be loaded and unloaded by a running process. Both the OSS and Guardian
environments support the following UNIX98 functions:
dlopen()
dlclose()
dlsym()
dlerror()
OSS and Guardian also provide the HP function dlresultcode(). See the Open System Services
Library Calls Reference Manual for detailed descriptions of these functions.
When you request linking through the HP C compiler, the compiler, by default, tells the nld, ld,
or eld linker to search the standard C library for static and dynamic library modules. However,
if you invoke nld, ld, or eld directly, you must specifically tell it to search the standard C library.
Standard and Alternate Library Directories
Libraries on a UNIX workstation are usually kept in the /usr/lib and /lib directories. The OSS
file system provides the same directory structure, so that ported applications can keep their libraries
in the same locations.
You should check the location and content of libraries on the system you are porting from and on
the system you are porting to. If your UNIX system does not keep its libraries in /usr/lib and
/lib, or if it uses other implementation-defined library directories, you might need to compensate
when you link a ported program in the OSS environment.
To look for a library routine on your workstation, check /usr/lib, then /lib, then alternate
library directories. If your workstation compiler is ISO/ANSI compliant, it should have a -L flag.
The -L flag can be used to search for your own versions of the library routines. The HP C compiler
supports the -L flag.
The UNIX Workstation Development Environment 165