On Wednesday, 2 May 2018 at 21:55:31 UTC, Robert M. Münch wrote:
I have the following C++ function signature:

        uint _begin(Image& image, const InitParams* initParams)
and the following D code:
 class InitParams {
 }
 class B2D {
   uint _begin(ref Image image, InitParams initParams);
 }
But this compiles to the following signature which is not found by the linker: public: virtual unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image * &,class b2d::InitParams *) I don't understand why "ref Image" translates to "Image * &" and not "Image &". How can I get the C++ reference function signature written down in D?

If "Image" is a class then all classes are based as pointers to their respective object. So passing a ref to a class is kind of redundant. You want to use a struct which isn't passed by pointer, but by value. Which will then give you the signature you want.

Reply via email to