help-gplusplus
[Top][All Lists]
Advanced

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

Re: Q1: function-level linking is not working as expected


From: Paul Pluzhnikov
Subject: Re: Q1: function-level linking is not working as expected
Date: Thu, 26 Apr 2007 06:56:24 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Michael Kilburn <crusader.mike@gmail.com> writes:

> Yes, there are quite a few static object with
> non-trivial contructor/destructor. But, I thought that specifying
> -ffunction-sections
> -fdata-sections
> is equivalent of putting every function and static variable in a
> separate translation unit/object file.

Your experimental result clearly shows that it is *not* equivalent.

> In this case, since foo() does
> not reference anything -- the rest should be thrown away.

As I explained, the rest can't be thrown away because it is
*referenced* (but not from foo()).

> There is another suggestion -- maybe referencing something from static
> library (*.a) brings in all static variables (and their dependencies),

It doesn't. It is trivial to construct an experiment that proves this.

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]