Software & Finance





C# - Step 5.6 ClassInterfaceType.AutoDual





 

ClassInterfaceType.AutoDual (Discouraged to use since it might produce versioning conflicts and compilation problems)

 

When you use ClassInterfaceType.AutoDual like below

 

    [Guid("282902B4-5FB9-461d-9CD0-FE8DD851F979")]

    [ClassInterface(ClassInterfaceType.AutoDual)]

    [ProgId("SFTCSServer.MathCtrl")]

the following code will get generated on C++ client side with #import tlb file.

 

struct __declspec(uuid("282902b4-5fb9-461d-9cd0-fe8dd851f979"))

MathCtrl;

struct __declspec(uuid("7e8f71f8-8b44-3878-a180-1b9d5faeb06e"))

_MathCtrl : IDispatch

{

    __declspec(property(get=GetToString))

    _bstr_t ToString;

 

 

    _bstr_t GetToString ( );

    VARIANT_BOOL Equals (

        const _variant_t & obj );

    long GetHashCode ( );

    _TypePtr GetType ( );

    long AddNumbers (

        long a,

        long b );

    long MuliplyNumbers (

        long a,

        long b );

 

    //

    // Raw methods provided by interface

    //

 

      virtual HRESULT __stdcall get_ToString (

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

      virtual HRESULT __stdcall raw_Equals (

        /*[in]*/ VARIANT obj,

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

      virtual HRESULT __stdcall raw_GetHashCode (

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

      virtual HRESULT __stdcall raw_GetType (

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

      virtual HRESULT __stdcall raw_AddNumbers (

        /*[in]*/ long a,

        /*[in]*/ long b,

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

      virtual HRESULT __stdcall raw_MuliplyNumbers (

        /*[in]*/ long a,

        /*[in]*/ long b,

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

};

 

 

 

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