From http://publib.boulder.ibm.com/infocenter/comphelp/v9v111/index.jsp?topic=/com.ibm.xlcpp9.aix.doc/compiler_ref/opt_mkshrobj.htm
可以直接看例子
To construct the shared library big_lib.so from three smaller object files, type:
xlc -qmkshrobj -o big_lib.so lib_a.o lib_b.o lib_c.o
Output control
None.
Creates a shared object from generated object files.
You should use this option, together with the related options described below, instead of calling the linker directly (or using the makeC++SharedLib utility, in C++) to create a shared object. The advantages of using this option are the automatic handling of link-time C++ template instantiation (using either the template include directory or the template registry), and compatibility with -qipa link-time optimizations (such as those performed at -O5 )..
By default, the output object is linked with the runtime libraries and startup routines to create an executable file.
The compiler will automatically export all global symbols from the shared object unless you explicitly specify which symbols to export with the -bE :, -bexport : or -bnoexpall options, or if you use the -qnoweakexp option to prevent weak symbols from being exported.
Specifying -qmkshrobj implies -qpic .
You can also use the following related options with the -qmkshrobj :
-o shared_file The name of the file that will hold the shared file information. The default is shr.o. -qexpfile= filename Saves all exported symbols in filename . -e name Sets the entry name for the shared executable to name . The default is -enoentry . -q[no]weakexp Specifies whether symbols marked as weak (with the #pragma weak directive) are to be included in the export list. If you do not explicitly set this option, the default is -qweakexp (global weak symbols are exported).For detailed information on using -qmkshrobj to create shared libraries, as well as examples of using -qmkshrobj with priority values, see "Constructing a library" .
None.
To construct the shared library big_lib.so from three smaller object files, type:
xlc -qmkshrobj -o big_lib.so lib_a.o lib_b.o lib_c.o