Shared static constructors from C# EXE

Thalamus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 26 08:41:17 PST 2016


On Friday, 26 February 2016 at 08:37:35 UTC, Benjamin Thaut wrote:
> 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

Thanks Benjamin! I knew there had to be some simple thing I 
didn't know I needed to do here. It worked like a charm in the 
simple repro. In my actual code, I'm running into _deh_beg 
already defined and a few more linker errors, but I haven't had 
the chance to delve there yet.

thanks again!



More information about the Digitalmars-d-learn mailing list