[D-runtime] druntime should be a shared library/DLL

David Nadlinger code at klickverbot.at
Wed Feb 6 16:56:00 PST 2013


On Thu, Feb 7, 2013 at 1:10 AM, Walter Bright <walter at digitalmars.com> wrote:
> The thread code has some global variables where it keeps track of all
> threads. With the static library approach, there are two sets of these
> variables, and two sets of code to deal with them. They will conflict with
> each other, and any attempt to make DLLs will have to have some mechanism to
> decide which one wins. With druntime itself as a DLL, this is not an issue.
>
> The same problem with the gc.

Yes, of course you need to have the runtime as a shared library in
order to write a sane implementation. Martin's pull request does
change the make files accordingly.

But the situation is a *bit* more complex than that. For example,
currently the GC root ranges for static and TLS data are just
determined once at program startup by taking the address of the
respective marker symbols. This clearly can't work in the presence of
multiple images that can also be loaded and unloaded during execution,
and having a shared druntime doesn't magically change that.

David


More information about the D-runtime mailing list