How do I call a C++ struct default constructor from D?

kinke via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 7 02:46:24 PST 2017


On Tuesday, 7 February 2017 at 10:15:09 UTC, Atila Neves wrote:
> I can declare a C++ struct like so:
>
> extern(C++, mynamespace)
> struct Foo {
>    //...
> }
>
> But... I don't want to repeat the initialisation code for that 
> struct's default constructor. I can't declare one in D because 
> D doesn't allow default constructors for structs. What's my way 
> out? Thanks,
>
> Atila

I'm afraid there's no way out. I summarized some of my C++ 
interop findings incl. default constructor here: 
http://forum.dlang.org/thread/nqxsdehlydizatoprrax@forum.dlang.org


More information about the Digitalmars-d-learn mailing list