DIP45: fixing the dllimport/dllexport issue

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Aug 27 06:33:46 PDT 2013


On 8/27/13, Benjamin Thaut <code at benjamin-thaut.de> wrote:
> Well, a link would have been great:
>
> http://wiki.dlang.org/DIP45

Using export(identifier) is not going to be reliable, since chances of
clashes are high.
E.g. if libFoo uses export(Foo) and libBar also uses export(Foo), you
won't be able to distinguish between the two.

Instead I think 'identifier' should be a module name.

However, I have a better idea. Why not only introduce compiler
switches that are based on module names rather than having to annotate
what export does in code? For example:

dmd -m64 -export libB.* -import libA.* -of"libB.dll" dllmain.d libB.d
-L/DLL -L/IMPLIB:"libB.lib" -LlibA.lib

"-export libB.*" means all modules and subpackages of the libB package
should be exported, whereas "-import libA.*" means the opposite for
libA.

This way you don't have to edit any existing code.


More information about the Digitalmars-d mailing list