On Tuesday, 1 May 2018 at 15:24:09 UTC, Robert M. Münch wrote:
Hi, I'm mostly doing simple C-API wrappers around C++ code to
access thigns from D. However, I wanted to try how far I can
come using C++ directly.
I have the following C++ code in namespace N:
class Image : public Object {
Error create(int w, int h, uint32_t p) noexcept;
}
And I have the following D code:
extern (C++, N) {
class Object {
}
class Image : public Object {
uint create(int w, int h, uint pixelFormat);
}
}
So frist problem I see is, that a C++ class names Object is
pretty unfortunate as this is a reserved class name in D. And
DMD doesn't seem to allow using Object inside a C++ scope
(which IMO should be possible).
Am I right, that there is no chance to handle this case other
than ranming the C++ base class?
Would `pragma(mangle, ...)` work here?
https://dlang.org/spec/pragma.html#mangle