help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running initial code when in library


From: Paul Pluzhnikov
Subject: Re: Running initial code when in library
Date: Wed, 24 May 2006 11:25:48 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"Paulo Matos" <pocmatos@gmail.com> writes:

> I didn't know the linker was going to search for unused objects and if
> not used it would not include them. Nice to know.

All linkers I know (even the MS ones) work that way, and (AFAICT)
always did.

> I don't understand why this works this way.

It's the *only* reasonable way for linker to work.
If it didn't work that way, every program (when linked statically)
would include the *entire* code for all libraries it was linked
against (including libc, which is quite large).

> I have no other solution than using --whole-archive to linker right now,

You do have other solutions, e.g. explicitly list objects that must
be linked in, and the linker will do the right thing (pulling in
only necessary parts of the libraries).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]