help-gplusplus
[Top][All Lists]
Advanced

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

Re: Compiler doesn't create some static class members


From: Paul Pluzhnikov
Subject: Re: Compiler doesn't create some static class members
Date: 01 Feb 2005 17:03:50 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

johan_de_taeye@yahoo.com (Johan_De_Taeye) writes:

> The following behavior is noticed:
> - when the number of source files with static member definitions
> increases, not all of my metadata objects are being created.
> - when I move all the definitions of the static objects into a single
> file, all objects are created as expected.  Strange...
> - when multiple static libraries (each with a certain set of static
> metadata objects) are being linked together, only static members of
> one of the libraries are created.
> - When I explicitly reference the metadata object of a class in the
> main application, that metadata object is created correctly. Looks
> like a way to force the instantiation, albeit clumsy.

All of the above could be explained if some of the objects in which
you define your metadata objects are simply not linked into the
final executable (e.g. because no other object references them).

To understand how the linker decides whether to pull an object
from the library or whether to skip it, read this:
http://webpages.charter.net/ppluzhnikov/linker.html

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]