Download C for AIX User's Guide

Transcript
Notes
This option affects all library searches.
For a library name and path specied by the -l and -L options, the linkage editor searches, if they exist, the
.so library first and then the .a library.
Example
To compile myprogram.c searching both shared and static versions of the C for AIX compiler libraries,
enter:
xlc myprogram.c -brtl
“Compiler Options and Their Defaults” on page 218
“Options that Specify Linkage Options” on page 230
“bstatic, bdynamic”
“l” on page 286
“L” on page 285
bstatic, bdynamic
Option Type
Default Value
#pragma options
-flag
bdynamic
-
Syntax
-bstatic | -bdynamic
Purpose
Controls how libraries are processed by specifying which forms of library names the linkage editor looks
for.
Notes
The linkage editor searches library names and paths specied by the -l and -L options according to the
following criteria:
bdynamic
bstatic
For settings of the -lkey option appearing after the -bdynamic option, both libkey.so and libkey.a
library files are searched for by the linkage editor. This option remains in effect until overridden by
the appearance of the -bstatic option, which in turn affects -lkey options appearing after it.
For settings of the -lkey option appearing after the -bstatic option, only libkey.a library files are
searched for by the linkage editor. This option remains in effect until overridden by the appearance
of the -bdynamic option, which in turn affects -lkey options appearing after it.
The default option, -bdynamic, ensures that the C library (lib.c) links dynamically. To avoid possible
problems with unresolved linker errors when linking the C library, you must add the -bdynamic option to
the end of any compilation sections that use the -bstatic option.
Example
To compile myprogram.c using a static version of the libtask.a Task Library and a dynamic version version
of the libcomplex.aComplex Mathematics Library, enter:
xlc myprogram.c -bstatic -ltask -bdynamic -lcomplex
“Compiler Options and Their Defaults” on page 218
“Options that Specify Linkage Options” on page 230
“l” on page 286
“L” on page 285
Appendix A. Compiler Options
241