Re: C++ / Wrong function signature generated for reference parameter

2018-05-04 Thread Timoses via Digitalmars-d-learn
On Thursday, 3 May 2018 at 11:29:59 UTC, Robert M. Münch wrote: Not sure I understand this too. This is now what I get: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64 LIB: public: unsigned int

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 09:34:56 +, kinke said: That's why there's `extern(C++, class) struct Image`, see https://dlang.org/spec/cpp_interface.html#classes. Hi, thanks. I didn't understand the docs as without any code examples for all the different cases, it's hard to derive the syntax and how to

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread kinke via Digitalmars-d-learn
On Thursday, 3 May 2018 at 07:00:03 UTC, Robert M. Münch wrote: using struct won't give the correct signature That's why there's `extern(C++, class) struct Image`, see https://dlang.org/spec/cpp_interface.html#classes. Not sure about the const part too, if this is correct on the D side...

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 02:23:27 +, Rubn said: You want to use a struct which isn't passed by pointer, but by value. Which will then give you the signature you want. In addition to my other post, using struct won't give the correct signature. That's the signature I need: public: unsigned int __cd

Re: C++ / Wrong function signature generated for reference parameter

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 02:23:27 +, Rubn said: If "Image" is a class then all classes are based as pointers to their respective object. Hi, ok. Didn't remember that this is always the case. So passing a ref to a class is kind of redundant. Yes, that's why I was confused. You want to use a struc

Re: C++ / Wrong function signature generated for reference parameter

2018-05-02 Thread Rubn via Digitalmars-d-learn
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); } B

C++ / Wrong function signature generated for reference parameter

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
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