Interfacing with C++ Class named Object
Robert M. Münch
robert.muench at saphirion.com
Tue May 1 17:24:26 UTC 2018
On 2018-05-01 17:14:53 +0000, Robert M. Münch said:
> Yes, great! Thanks. I could extend the code now. But I get a next problem:
>
> extern (C++, b2d) {
> class AnyBase {
> bool isShared();
> }
>
> pragma(mangle, "Object");
> class b2dObject : AnyBase {
> }
>
> class Image : b2dObject {
> // class Image {
> uint create(int w, int h, uint pixelFormat);
> }
> }
>
> The linke complains about missing symbols:
>
> error LNK2001: "public: virtual bool __cdecl
> b2d::AnyBase::isShared(void)" (?isShared at AnyBase@b2d@@UEBA_NXZ)
> error LNK2001: "public: virtual unsigned int __cdecl
> b2d::Image::create(int,int,unsigned int)"
> (?create at Image@b2d@@UEAAIHHI at Z)
>
> I have in my C++ link lib:
>
> ?isShared at AnyBase@b2d@@QEBA_NXZ which demangles to => public: BOOL
> __cdecl b2d::AnyBase::isShared(void)const __ptr64
>
> So, the difference is the "virtual" specifier on the D side, while the
> C++ mangeling is missing this. I have this for many functions.
>
> Any idea how to handle this?
Answering myself. There is a final keyword missing:
class Image : b2dObject {
// class Image {
final uint create(int w, int h, uint pixelFormat);
}
With this it's working.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-learn
mailing list