What is the wrong with my C++ interfacing

Ferhat Kurtulmuş aferust at gmail.com
Mon Mar 16 07:11:28 UTC 2020


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.


More information about the Digitalmars-d-learn mailing list