Problems with Reflection in Static library

Kagamin spam at here.lot
Sat Dec 18 09:16:26 PST 2010


Mandeep Singh Brar Wrote:

> The Object.factory method does not seem to work if my class has been compiled as a static library.
> Can you please let me know how to solve this. I have tried replacing public with export for class
> testD, but that does not help.

The class A is not referenced from module user, so the linker thinks, it's not used and doesn't compile it in (you don't pay for what you don't use). This applies to libraries. Objects are included entirely.
Libraries can be of any size, but included is only needed stuff. Consider phobos library is 3MB size, you don't want it to be fully included in your every application, do you? But if you want to use its arbitrary members at runtime, you'll need to have them all.


More information about the Digitalmars-d-learn mailing list