Software & Finance





C# - Step 5.3 ComInterfaceType.InterfaceIsDual





 

ComInterfaceType.InterfaceIsDual - COM interface types supports both IDispatch and IUnknown mode.

 

When you use [InterfaceType(ComInterfaceType.InterfaceIsDual)], the following code will get generated on C++ client side with #import tlb file.

 

struct __declspec(uuid("12d1edac-20c0-4faa-a774-b6f4c300b47e"))

IMathCtrl : IDispatch

{

    long AddNumbers (

        long a,

        long b );

      virtual HRESULT __stdcall raw_AddNumbers (

        /*[in]*/ long a,

        /*[in]*/ long b,

        /*[out,retval]*/ long * pRetVal ) = 0;

};

 

inline long IMathCtrl::AddNumbers ( long a, long b ) {

    long _result = 0;

    HRESULT _hr = raw_AddNumbers(a, b, &_result);

    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));

    return _result;

}

 

 

Back to Index of Steps for C# class Library Server and C++ Index

 

Click here to download the complete source code of C# Class Library Server and C++ Client