What is the wrong with my C++ interfacing

Ferhat Kurtulmuş aferust at gmail.com
Sun Mar 15 20:53:49 UTC 2020


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);
}




More information about the Digitalmars-d-learn mailing list