|Architecture||Command(s) that prints what libraries a binary needs||
Library Path |
Under Solaris the
/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
-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
g++ -shared -L/users/ptolemy/lib.$PTARCH -o librx.so *.o
or by passing the -R flag to the linker:
g++ -shared -Wl,-R,/users/ptolemy/lib.$PTARCH -o librx.so *.o
Constructors and Destructors between SunOS4.x and Solaris2
The Solaris2 SPARCompiler c++4.0 Answerbook says
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.
The SunOS4.x port of Ptolemy uses BSD
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
linked when run on a SunOS4.x
ptolemy@mho 2% ldd ~ptolemy/bin.sun4/pigiRpc
/users/ptolemy/bin.sun4/pigiRpc: statically linked
Under HPUX, shared libraries must be executable or they will not work. Also, for performance reasons, it is best if the shared libraries are not writable.
.sl suffix, and HPUX uses the
SHLIB_PATH environment variable to search for libraries.
-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. Other platforms don't need both arguments present.