How to call a function from a dll created with d ?

frame frame86 at live.com
Fri Jul 8 09:21:15 UTC 2022


On Thursday, 7 July 2022 at 17:29:42 UTC, cc wrote:

> Does importing dimedll into app.d properly NOT link in the 
> functions that are exported to the DLL?  When I tried something 
> similar with dmd, I had to create a .di file containing just 
> stubs, otherwise it looked like it was ignoring the DLL and 
> compiling in an additional copy of each fuction.

IMHO this is the expected behaviour since the compiler comes 
before the linker and `pragma(lib)` is a linker directive, so if 
dimedll.di is not present it looks for dimedll.d instead and just 
compiles the code.

The link to DLL is only present in the actual lib-file and only 
used by the linker.

The pitfall with DMD is that the automatic generated di-file is 
not usable as it contains a mixin that is meant for the DLL but 
not the application that links it, resulting in _ModuleInfoZ 
error while trying.


More information about the Digitalmars-d-learn mailing list