Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 09:28:15 UTC, drug wrote: On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote: Ok, here is a solution. I opened my lib (yielded by my auxilary cpp) using 7zip. There are two files containing symbol names, 1.txt and 2.txt. I searched for names of member functions. They

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread drug via Digitalmars-d-learn
On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote: Ok, here is a solution. I opened my lib (yielded by my auxilary cpp) using 7zip. There are two files containing symbol names, 1.txt and 2.txt. I searched for names of member functions. They were not there because c++ compiler does not compile

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 16 March 2020 at 07:46:00 UTC, drug wrote: On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote: 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();    

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread drug via Digitalmars-d-learn
On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote: 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

Re: What is the wrong with my C++ interfacing

2020-03-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Arine via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş wrote: On Sunday, 15 March 2020 at 21:16:43 UTC, Arine wrote: On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş I wouldn't use a class on the D side, unless your C++ type uses virtual functions. Classes in D are different

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:16:43 UTC, Arine wrote: On Sunday, 15 March 2020 at 20:53:49 UTC, Ferhat Kurtulmuş 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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Arine via Digitalmars-d-learn
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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread drug via Digitalmars-d-learn
15.03.2020 23:53, Ferhat Kurtulmuş пишет: 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); } Ah, really, you use classes on D side.

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread drug via Digitalmars-d-learn
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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
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

Re: What is the wrong with my C++ interfacing

2020-03-15 Thread drug via Digitalmars-d-learn
15.03.2020 22:39, Ferhat Kurtulmuş пишет: The original C++ class https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315: template class Size_ { public:     typedef _Tp value_type;     //! default constructor     Size_();     Size_(_Tp _width, _Tp

What is the wrong with my C++ interfacing

2020-03-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
The original C++ class https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315: template class Size_ { public: typedef _Tp value_type; //! default constructor Size_(); Size_(_Tp _width, _Tp _height); Size_(const Size_& sz);