Table 1:
D.4.1 Solaris
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 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 *.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.D.4.2 SunOS
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 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
D.4.3 HPUX
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
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.