On Tuesday, 7 February 2017 at 10:46:24 UTC, kinke wrote:
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/[email protected]

Ugh, I was afraid of that. I ended up having to write (!) a C++ function that returned the default-initialised struct and called that from D.

It got uglier soon after...

I've only every done trivial C++ integration before. As soon as I tried something "real" it all broke down incredibly fast. Probably going to have to file some bugs on name mangling.


Atila


Reply via email to