Solaris and gnu linking

Solaris and gnu linking

Post by n.. » Thu, 06 Jul 1995 04:00:00



I use options:

"c++  -v -g -shared  -o poskus.mexsol poskus.c  -nostdlib -lgcc -lm "

Why "ldd" result is (although there is -nostdlib options :)

        libm.so.1 =>     /usr/lib/libm.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1

 
 
 

Solaris and gnu linking

Post by Casper H.S. Dik - Network Security Engine » Thu, 06 Jul 1995 04:00:00



>I use options:
>"c++  -v -g -shared  -o poskus.mexsol poskus.c  -nostdlib -lgcc -lm "
>Why "ldd" result is (although there is -nostdlib options :)
>        libm.so.1 =>     /usr/lib/libm.so.1
>        libc.so.1 =>     /usr/lib/libc.so.1
>        libdl.so.1 =>    /usr/lib/libdl.so.1

You included "libm.so" which imports libc.so and libdl.so.
Only libmsymbols in libm.so are vissible to your protgram.

Note that "-shared" is an option to *built* shared libraries, not
an option to link dynamically.  The link succeeds because no -z text
was specified.

Without the -shared, the link will probably fail as the libc symbols
are *not* available, but you will get an executable.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.