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,