Instantiating a class in d file with an extern (c) block causes immediate segfault!

Gregor Richards Richards at codu.org
Thu Jul 31 10:38:05 PDT 2008


kamatsu wrote:
> On my system, when I do:
> 
> gdc *.c *.d
> ./a.out
> 
> I get:
> 
> segmentation fault
> 
> I can instantiate classes fine with normal D, but as soon as the extern(c) stuff creeps in bang - no classes for me!
> 
> Can you please explain what's wrong? And how I can fix it?
> 

You're using a C main and haven't initialized the D environment. 
Initializing D from C is quite difficult, I would recommend using a D 
main (such that D is initialized automatically) and using it to call the 
primary C function.

  - Gregor Richards


More information about the D.gnu mailing list