Interfacing with XPCOM
Walter Bright
newshound1 at digitalmars.com
Sun Nov 30 18:22:07 PST 2008
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++) ?
>>
>
>
> Yes, I think so. But I should probably test the theory with dmd 2.0
> first just to make sure. This is just about over my head since I'm not
> too familiar with C++ internals. In terms of XPCOM, I believe that when
> an interface is assigned an implementation pointer and the interface
> method is called, the most important detail is that the /parameter/
> signature at a specific vtable index match that of the implementation's
> at the same index: that is, the method names are not important except
> as an alias for client to use; it is assumed that the interface methods
> will match the calling convention and argument types of the
> implementation which was assigned to it).
>
> So my question would be, in terms /calling conventions/ in an
> /interface/ (not a class), does extern(System) differ in any way from
> extern(C++). Does a "this" pointer get prepended to the argument list
> of a C++ method call? I apologize if this is an ignorant question. I'm
> almost clueless here. I'm assuming that the only difference in the
> extern(C++) is that it:
>
> (1) changes the interface to have a "normal" vtable (as XPCOM needs) and
> (2) allows for a system calling convention (method name not being
> important other than that the parameters of interface and implementation
> match).
The system linkage was devised to match the Microsoft "syscall"
convention. It really has no meaning on linux, so we can make it
whatever it needs to be.
The C++ convention is designed to match whatever C++ does on the target
platform. Since Linux doesn't have any Windows or System calling
convention, it would seem that C++ is the one.
More information about the Digitalmars-d
mailing list