Interfacing with XPCOM

John Reimer terminal.node at gmail.com
Sun Nov 30 18:30:56 PST 2008


Hello Walter,

> John Reimer wrote:
> 
>> Hello Walter,
>> 
>>> So are you saying that XPCOM will work on Linux with D if only the
>>> extern(Windows) was actually extern(C++) ?
>>> 
>> Just to make this clear, I'm banking on that the fact that
>> extern(C++) on an interface should also remove the necessity to alias
>> to a COM interface on linux.  I am guessing that extern(C++) makes a
>> vtable the same as COM minus the extern(Windows) decoration.  If this
>> is not exactly true, then my hypothesis won't hold. :-)
>> 
> Neither affects the vtable layout. They affect the calling convention
> (register usage, parameter order, stack cleaning, return value).
> 


Okay, I'm confused then.  While I understand that the compiler uses specifically 
uses extern(...) to describe the calling convention, I /assumed/ that the 
compiler was detecting this the extern(C++) like so:

extern (C++)
{
  interface D
  {
    int bar(int i, int j, int k);
  }

  D getD();
}


And converting what would normal be a D interface (with RTTI reference in 
first element of vtable) to a regular vtable compatible with a C++ class 
type?

How is the vtable made C++ compatible?

-JJR





More information about the Digitalmars-d mailing list