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

cc cc at nevernet.com
Thu Jul 7 17:29:42 UTC 2022


On Sunday, 3 July 2022 at 09:43:20 UTC, frame wrote:
> app.d:
> ```d
> module app;
> import dimedll;
>
> import std.stdio;
> import std.stdio : log = writeln;
>
> pragma(lib, "dimedll.lib");
>
> void main() { 	
>    log("Lets build our own ime");
>    testFunc();		
> }
> ```
>
> You should be able to change contents in the DLL and run the 
> executable wihtout re-compiling (the library file should be 
> round ~2kB).
>
> PS: ddemangle just waits for your input. You copy in the 
> mangled symbol like `__D7dimedll12__ModuleInfoZ` and press 
> enter ;-)

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.


More information about the Digitalmars-d-learn mailing list