| United States-English |
|
|
|
![]() |
HP-UX Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line OptionsLibraries |
|
Library options allow you to create, use, and manipulate libraries. -b The -b option creates a shared library rather than an executable file. Example: The following command links utils.o and creates the shared library utils.so. aCC -b utils.o -o utils.so For more information on shared libraries, see “Creating and Using Libraries”. -dynamic The -dynamic option produces dynamically bound executables. See “-minshared” for partially statically bound executables. The default is -dynamic. -exec The -exec option indicates that any object file created will be used to create an executable file. Constants with a protected or hidden export class are placed in the read-only data section. This option also implies -Bprotected_def. It makes all defined functions and data (even tentatively defined data) protected by default (unless otherwise specified by another binding option or pragma). -lname The name parameter forms part of the name of a library the linker searches for when looking for routines called by your program. The -lname option causes the linker to search one of the following default libraries, if they exist, in an attempt to resolve unresolved external references:
Whether it searches the shared library (.so) or the archive library (.a) depends on the value of the -a linker option or the -minshared compiler option.
Example: aCC file.o -lnumeric This command directs the linker to link file.o and (by default) search the library /usr/lib/hpux32/libnumeric.so. -L directory The directory parameter is the HP-UX directory where you want the linker to search for libraries your program uses before searching the default directories. The -L directory option causes the linker to search for libraries in directory in addition to using the default search path. See -lname option for default search path. The -L option must precede any -lname option entry on the command line; otherwise -L is ignored. This option is passed directly to the linker. Example: The following example compiles and links prog.C and directs the linker to search the directories and /project/libs for any libraries that prog.C uses (in this case, mylib1 and mylib2). aCC -L/project/libs prog.C -lmylib1 -lmylib2 -minshared The -minshared option indicates that the result of the current compilation is going into an executable file that will make minimal use of shared libraries. This option is equivalent to -exec -Bprotected. +nostl By eliminating references to the standard header files and libraries bundled with HP aC++, the +nostl option allows experienced users full control over the header files and libraries used in compilation and linking of their applications, without potential complications that arise in mixing different libraries.
For more information on shared libraries, see “Creating and Using Libraries”. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||