about -shared option

Lin George george4academic@yahoo.com
Thu May 4 06:55:00 GMT 2006


Hello everyone,


I have used -shared options for a long time. Today
when I dig into the detailed description of shared
option of gcc, I found something strange to me.

Quote from gcc man page,

--------------------
-shared 
Produce a shared object which can then be linked with
other objects to form an executable. Not all systems
support this option. For predictable results, you must
also specify the same set of options that were used to
generate code (-fpic, -fPIC, or model suboptions) when
you specify this option.[1] 

1. 
On some systems, gcc -shared needs to build
supplementary stub code for constructors to work. On
multi-libbed systems, gcc -shared must select the
correct support libraries to link against. Failing to
supply the correct flags may lead to subtle defects.
Supplying them in cases where they are not necessary
is innocuous.
--------------------

I only understand this statement "Produce a shared
object which can then be linked with other objects to
form an executable." and I do not know what are the
other points mean.

Could anyone help to introduce what do they mean and
will the points impact my current work/previous
comprehension of shared option of gcc?


regards,
George

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Gcc-help mailing list