Type safety could prevent nuclear war

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 4 23:15:56 PST 2016


On Fri, Feb 05, 2016 at 04:39:13AM +0000, tsbockman via Digitalmars-d wrote:
[...]
> Thanks for the explanation. That does sound basically the same as the
> C issue.
> 
> Since .di files are normally generated automatically, this seems like
> an easily solvable problem:
> 
> 1) When compiling a library and its attendant .di file(s), generate a
> unique version identifier (such as a UUID or a hash of the completed
> binary) and append it to both the library and each .di file.
> 
> 2) Whenever someone tries to link against the library, verify that the
> version ID matches. If it does not, issue a prominent warning.
[...]

This would break shared library upgrades that do not change the ABI.

Plus, it doesn't fix wrong linkage at runtime, because the dynamic
linker is part of the OS and the D compiler has no control over what it
does beyond the standard symbol matching and relocation mechanisms. If
you compile against libfoo, but at runtime the user happens to have a
stale, ABI-incompatible version of libfoo hanging around that gets
picked up by the dynamic linker, you'll have the same problem.


T

-- 
VI = Visual Irritation


More information about the Digitalmars-d mailing list