AFAIK you can only use COM from windows anyway. OK I have been using them from linux but only with WINE help.

On Thu, Nov 2, 2017 at 3:22 PM, Guillaume Piolat via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
I wonder if anyone has used COM in dlang extensively.

Context: I must use COM FFI interfacing on systems that aren't necessarily  Windows. It is essential that the layout of interfaces and classes are the same than in equivalent C++ objects.


Question 1. Is it mandatory to inherit from core.sys.windows.unknwn.IUnknown, or just having an interface named "IUnknown" validate it for being a COM interface?

   If yes, then how am I supposed to use COM interfaces in other OSes? core.sys.windows.unknwn.IUnknown is defined under version(Windows).

   I wonder what the exact compiler hook is.


Question 2. If this fails, may I emulate COM vtable layout with extern(C++) class? I wonder what the exact differences are anyway between extern(C++) and the special IUnknown.


Question 3. It seems I can inherit both from A D object and a COM interface. What will be the choosen layout?