On Thursday, 10 March 2016 at 02:14:19 UTC, H. S. Teoh wrote:
On Thu, Mar 10, 2016 at 01:33:41AM +0000, Yuxuan Shui via
Digitalmars-d-learn wrote:
[...]
You can't rely on invoking the compiler to link these objects,
because if you're using shared libraries, it will be the OS's
dynamic linker that will get invoked to resolve the references,
and different versions of shared libraries may have a different
set of TypeInfo's, and the compiler may not be able to generate
the required TypeInfo's.
A better way is to use the OS linker's "weak symbol" feature,
where a symbol is allowed to be defined multiple times (with
identical content), and the linker (both dynamic and static)
will choose the first definition that it finds.
However weak symbol overriding is deprecated on Linux (see
ld.so(8)).
If we want to go all out to solve this problem, there are clearly
solutions. But for now there doesn't seem to be enough benefit to
justify the amount of work needed.
T