Windows static linking question
frame
frame86 at live.com
Tue Apr 27 06:29:40 UTC 2021
From my source...
```d
// main.d
pragma(lib, common.lib);
extern (C) void fun(bool something);
```
```d
// common.d
export extern (C) void fun(bool something) {
// ...
}
```
...I'm creating a static linked DLL with this command...
```
rdmd --build-only -L/DLL -L/OUT:common.dll -m64 -of=common.dll
common.d
```
... and this works.
However, I get a ```std.file.FileException at std\file.d(991):
Attempting to rename file common.dll.tmp to common.dll``` error
every time at compiling because of the ```-L/OUT``` argument. But
I cannot omit it because it would create and link a
common.dll.tmp instead - for whatever reason.
I know there is a ```-lib``` switch which also can create a
common.lib, but that's obviously not the same as the LIB does not
target to the DLL and the code ends just compiled in than linked.
So, is there another switch combo to achieve static linking by
creating a LIB-file? Like a ```-lib -target=```?
More information about the Digitalmars-d-learn
mailing list