/usr/ccs/bin/dump -Lv
file will tell you more shared library information about a binary. Under Solaris2, binaries compiled with shared libraries can have a path compiled that is used to search for shared libraries. This path is called the RPATH
. The ld
option -R
is used to set this at compile time. Use /usr/ccs/bin/dump -Lv
binary to view the RPATH
for binary. The RPATH
for a library can be set at the time of creation with the -L
flag:g++ -shared -L/users/ptolemy/lib.$PTARCH -o librx.so *.oor by passing the -R flag to the linker:
g++ -shared -Wl,-R,/users/ptolemy/lib.$PTARCH -o librx.so *.o
main()
is executed. This behavior is slightly different from that on SunOS4.x where only the static constructors from library modules used by the application are called.
ld
style linking, which will not
work with a binary that is linked with any
shared libraries. For incremental linking of stars to work, the ldd command must return statically
linked
when run on a SunOS4.x pigiRpc
or ptcl
binary.ptolemy@mho 2% ldd ~ptolemy/bin.sun4/pigiRpc
/users/ptolemy/bin.sun4/pigiRpc: statically linked
Under HPUX, shared libraries have a .sl
suffix, and HPUX uses the SHLIB_PATH
environment variable to search for libraries.
Under HPUX10, when you are building shared objects, you need to specify both -fPIC
and -shared
. (-fpic -shared
will also work). The reason is that the temporary files that are generated by g++'s collect program need to be compiled with -fPIC
or -fpic
. Other platforms don't need both arguments present.