Shared static constructors from C# EXE

Benjamin Thaut via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 26 00:37:35 PST 2016


On Thursday, 25 February 2016 at 17:46:18 UTC, Thalamus wrote:
> On Thursday, 25 February 2016 at 16:05:37 UTC, Benjamin Thaut 
> wrote:
>> [...]
>
> Thanks Benjamin. When I went to whittle this down to its barest 
> essentials, though, the repro is pretty simple. It involves 
> LIBs, but not Dlls, and it doesn't require anything but a 
> single D EXE.
>
> [...]

The problem is that when you build with -lib the resulting 
library is optimized for linker stripping. E.g. everything that 
is not directly used will not be pulled into the final 
executable. If you want everything in the final exectuable you 
shouldn't be using a .lib file. Instead compile with -c resutling 
in a .obj file and link the resulting .obj file into your 
executable. Then everything will end up in the final executable 
even if its not directly used.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list