On Saturday, 2 July 2022 at 20:43:41 UTC, Vinod KC wrote:
But I got this error message.
dime.obj : error LNK2001: unresolved external symbol
__D7dimedll12__ModuleInfoZ
dime.exe : fatal error LNK1120: 1 unresolved externals
Error: linker exited with status 1120
I tried the -H switch. You can't rely on that. I comment the
lines that shouldn't be there - then it should work:
dimedll.di
```d
// D import file generated from 'dimedll.d'
module dimedll;
// import core.sys.windows.dll;
// import std.stdio;
// mixin SimpleDllMain!();
export void testFunc();
```
dimedll.d:
```d
module dimedll;
import core.sys.windows.dll;
import std.stdio;
mixin SimpleDllMain;
export void testFunc() {
writeln("This is from dll");
}
```
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 ;-)