Windows static linking question

Mike Parker aldacron at gmail.com
Tue Apr 27 11:08:29 UTC 2021


On Tuesday, 27 April 2021 at 10:43:20 UTC, frame wrote:
> On Tuesday, 27 April 2021 at 08:50:37 UTC, Mike Parker wrote:
>
>> What specifically are the linker errors? Is it referring to 
>> `_DLLMainCRTStartup` or something else?
>
> Various "unresolved external symbol", mostly
> ```..._ClassZ```,
> ```...__ModuleInfoZ```,
> ```..._initZ``` from my classes and functions
> but also ```_D3std5regex__T8CapturesTAyaZQo6__initZ```
>
>> Also, I suspect the reason you're getting the renaming errors 
>> with rdmd is because you're passing both `-L/OUT:common.dll` 
>> and `-of=common.dll`.
>
> No, it's caused by ```-L/OUT``` only. ```-of``` is redudant 
> here indeed, but doesn't change anything.

So you have more than just common.d? You need to compile and link 
all of your source modules. The big `-I` is for imports, for the 
compiler to know what symbols are available. You will also need 
to either include all of the source files on the command line OR 
specify `-i`, which will tell the compiler to compile all 
imported files except the `std` namespace. rdmd does that by 
default.


More information about the Digitalmars-d-learn mailing list