On Sunday, 29 March 2020 at 17:32:59 UTC, kinke wrote:
On Sunday, 29 March 2020 at 15:20:52 UTC, YD wrote:
So what do I need to declare in the D file for it to match the library entry? Thanks!

This is similar to https://issues.dlang.org/show_bug.cgi?id=19260, and can be worked around the same way by messing manually with the mangled name, if you can't adapt the C++ side. The actual problem is that you can't express a mutable reference to a const class object (as opposed to a struct) in D (`const Y` is a const reference to a const Y object).

(This problem somehow does not appear on Linux where the library file is compiled with gcc, though)

The Itanium C++ mangling doesn't differentiate between:

void foo(const Y *);       // what you have on the C++ side
void foo(const Y * const); // corresponds to D `void foo(const Y)`

Thanks! I tried this:

    class X {
        version(Windows) {
            pragma(mangle, X.call.mangleof.replace("QBV","PBV"))
            final void call(const(Y)) const;
        } else {
            final void call(const(Y)) const;
        }
    }

and it worked. Thanks very much again!

Reply via email to