Dll support: testers needed

Benjamin Thaut code at benjamin-thaut.de
Sun Jan 7 10:12:00 UTC 2018


Am 07.01.2018 um 03:57 schrieb rikki cattermole:
 > +infinity
 >
 > Few things I would like answered:
 >
 > - Why -useShared and not -fPIC?
 >    - If -useShared why not use it on *nix to turn on -fPIC?

Because the DIP says that -useshared and -fPIC are loosley comparable. 
This does not mean that they are the same or interchangeable. In fact 
they are not. On linux when building a executable that uses a shared 
library -fPIC is not neccessary, unless your distribution requires 
position independend code everywhere. On windows on the other hand you 
will need to pass -useshared when building a executable that uses shared 
libraries.

 > - Why isn't DllIsUsedFromC.no automatically detected?

Because its not possible. I don't know of any way to detect wether a dll 
is loaded by a c-executable or d-executable. As a result the user has to 
specify it. The main problem here is that currently D Dlls hijack all 
threads. This is neccessary because currently there is no shared version 
of phobos, so the information about the threads can't be shared between 
multiple D dlls. One possibility would also be to remove the thread 
hijacking alltogether and require the user to manually add threads that 
have been created from C. This is also the current state on linux if I'm 
not mistaken. But doing so would break backwards compatibility.

 > Regarding C-runtime, yes we need to distribute every version that we 
support on Windows. The compiler will pick the latest (or the installer 
I guess) to use, but we should be able to switch between them. Either 
that or we ship a static lib of Phobos to be linked into a dll upon 
first request of a specific C-runtime.

That really is a problem I'm not going to solve. It is more a problem of 
distributing dmd and building the installer which is beyond the scope of 
my current PR.

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list