C# - Step 5.1 ComInterfaceType.InterfaceIsIUnknown
ComInterfaceType.InterfaceIsIUnknown - This COM interface type supports only early binding.
When you use [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] , the following code will get generated on C++ client side with #import tlb file.
struct __declspec(uuid("12d1edac-20c0-4faa-a774-b6f4c300b47e"))
IMathCtrl : IUnknown
{
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
|