Problems with Reflection in Static library
Stanislav Blinov
blinov at loniir.ru
Mon Dec 20 08:32:21 PST 2010
19.12.2010 10:51, Mandeep Singh Brar пишет:
> Thanks a lot for your reply Tomek. I understand what you are saying
> but this would not work for me. The reason is that i am trying to
> make some kind of plugins from these libs. So i would not know the
> name objectFactory also in advance (multiple plugins will not be
> implementing the same named method and linking statically).
>
> For now i am just merging these two into the same place.
In general, it's not a very good idea to make plugins using static
linkage. Even if your plugins will be dynamic libraries (dll/so), which
is currently not possible at least on Linux (and at least with dmd, I
don't know about gdc2), but the core to which they are plugged-in
remains static library, you may and most certainly will get unpleasant
surprises. Reason being, any static data contained in the static library
will be duplicated for every executable/dll that links to it. I don't
know if anything can be done with it (actually, I think nothing can be).
So for plugins, it's better to keep the 'core' also as a dynamic
library. But, again, dmd is currently is not on good terms with dynamic
linking (aside from loading a C dll at runtime, but that doesn't count).
More information about the Digitalmars-d-learn
mailing list