On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote:
On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş

extern(C++, cv){
extern(C++, class) struct Size_(_Tp){
    @disable this();
        ~this() { }

    final _Tp area() const;
    final double aspectRatio() const;
    final bool empty() const;

    _Tp width; //!< the width
    _Tp height; //!< the height
}
}

extern(C++){
    cv.Size_!int* createSizeIntWH(int w, int h);
}

void main()
{
        Size_!int* sz = createSizeIntWH(200, 100);
        writeln(sz.width);
}

This worked for me too. But member functions are still causing linker error. It seems like docs (https://dlang.org/spec/cpp_interface.html) do not cover those situations. Is there any other sources to read for it. Maybe you make a pull request to docs covering C++ interfacing tips in detail.

Reply via email to