Options '-shared' and '-Wl,-shared'

Phil Edwards phil@jaj.com
Mon Jan 20 15:09:00 GMT 2003


On Mon, Jan 20, 2003 at 08:02:37PM +0530, Linux Geek wrote:
>    Hi all,
> 
> what is the difference in doing this
> 
> g++ -shared -o libfoo.so foo.cpp

This is correct.


> And doing this
> 
> g++ -Wl,-shared -o libfoo.so foo.cpp

This is often wrong.


> If there is impact if any, then is it in the compiling process or the 
> linking process ?

The second only tells the linker what you're doing.  The first informs the
compiler driver of what you're doing; it will inform the linker, and possibly
make other changes as well, depending on the platform and the situation.


> Thanks very much for the time spared.

This list is for discussion of libstdc++-v3, so please take other questions
to a more appropriate forum.  The comp.unix.program* newgroup, for example.


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002



More information about the Libstdc++ mailing list