Quoting Rowel Atienza <[EMAIL PROTECTED]>:

> I think when you execute:
> 
> gcc prime.c -o prime -lm
> 
> you are actually telling the linker to dynamically link "prime" to libm.so
> not statically to libm.a since linux is an elf system. The rule for ld for
> elf and sunos is to link *.so 1st if it is present. Otherwise, use *.a .

I stand corrected.  For a system like linux, dynamic linking
is standard, and to force static linking to libm.a you need to
add the --static option.

But for other Unix system, my explanation still holds true, regarding
the -L and -l options for gcc.

Furthermore, if you want to build modules that will go into shared
libraries or that you want to link in dynamically to other executables,
you need the --shared, -fPIC, -fpic options.

P~Manalastas
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to [EMAIL 
PROTECTED]

Reply via email to