Software & Finance





C# - Step 5.2 ComInterfaceType.InterfaceIsIDispatch





 

ComInterfaceType.InterfaceIsIDispatch - This COM interface type supports only late binding.

 

When you use [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)], 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 );

};

 

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

    long _result = 0;

    _com_dispatch_method(this, 0x1, DISPATCH_METHOD, VT_I4, (void*)&_result,

        L"\x0003\x0003", a, b);

    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