On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş wrote:
On Sunday, 15 March 2020 at 20:46:14 UTC, drug wrote:
15.03.2020 23:25, Ferhat Kurtulmuş пишет:
On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote:
15.03.2020 22:39, Ferhat Kurtulmuş пишет:


What is the D version of `createSizeIntWH`? In C++ it returns a pointer but in D version it returns an instance.

extern(C++){
     cv.Size_!int createSizeInt();
     cv.Size_!int createSizeIntWH(int w, int h);
     void deleteSizeInt(ref cv.Size_!int sz);
}


createSizeIntWH returns a pointer to instance, not an instance. Try:
cv.Size_!int* createSizeIntWH(int w, int h);

I doubt it because in https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d

cpp code:
Derived *createInstance(int i)

d code:
extern (C++){
    ...
    Derived createInstance(int i);
}

I wouldn't use a class on the D side, unless your C++ type uses virtual functions. Classes in D are different from structs, it is not the same as C++ where they are basically the same thing.

Reply via email to