Getting an access violation before main starts

Matt via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 10 19:01:54 PDT 2014


On Wednesday, 11 June 2014 at 01:52:49 UTC, Kapps wrote:
> The digitalmars.D.learn newsgroup is a more appropriate place 
> for this, but as for your issue, one thing to keep in mind is 
> that static constructors are run before main:
>
> import std.stdio;
>
> static this() {
> 	writeln("Foo");
> }
>
> void main() {
> 	writeln("main");
> }
>
> $ rdmd test.d
> Foo
> main

Thank you for that, but I've tried moving everything out of all 
static constructors I used (one, in the Window module, which 
consisted of DerelictSDL2.load(); SDL_Init(SDL_INIT_EVERYTHING);, 
without any change to the problem.


More information about the Digitalmars-d mailing list