thiscall calling convention

Jarrett Billingsley kb3ctd2 at
Mon Oct 23 06:59:56 PDT 2006

"Max Samuha" <maxter at> wrote in message 
news:o14pj2teu31k82a6rnqfc7jbk422lrm05l at
>I have a COM object which uses __thiscall linkage for its methods
> (guys who created the object have perfect sense of humor). Would you
> advice me of a good way to call those methods from D?

To use any COM interface from D, you can just create an interface which 
derives from IUnknown.  D will make the interface COM-compatible.


interface SomeInterface : IUnknown
    HRESULT method1();

extern(Windows) export CreateSomeInterface();


SomeInterface i = CreateSomeInterface();

Of course, if the library you're using (what are you using anyway?) doesn't 
have a function which creates an instance of the COM object for you, you'll 
have to use QueryInterface from a base COM object, but.. 

More information about the Digitalmars-d-learn mailing list