IUnknown -> object => null ???
-
Hi I am having a COM interface method like this:- interface IMain : IUknown { HRESULT GetInterface([in]IID riid, [out, iid_is("riid")]IUnknown **ppInterface); } and importing the idl/tlb to metadata; the above method is translated as follows:- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)] void GetInterface([In] Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppInterface); When i call this from the .NET client like this:- Guid someItfGUID = "6BD5A170-D0DC-4b59-8D86-2651C46CB6CC"; object itfObject = null; iMain.GetInterfacesomeItfGUID, out itfObject); IController ctrlr = itfObject as IController; I see that the itfObject is null even after the call to GetInterface but does not fail on the COM side. Let me know if you get any idea why itfObject is null [why the IUnknown/IController is not transported across]. Thanks Vivek Ragunathan
Programming is an art, Code is a poem !!!
-
Hi I am having a COM interface method like this:- interface IMain : IUknown { HRESULT GetInterface([in]IID riid, [out, iid_is("riid")]IUnknown **ppInterface); } and importing the idl/tlb to metadata; the above method is translated as follows:- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)] void GetInterface([In] Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppInterface); When i call this from the .NET client like this:- Guid someItfGUID = "6BD5A170-D0DC-4b59-8D86-2651C46CB6CC"; object itfObject = null; iMain.GetInterfacesomeItfGUID, out itfObject); IController ctrlr = itfObject as IController; I see that the itfObject is null even after the call to GetInterface but does not fail on the COM side. Let me know if you get any idea why itfObject is null [why the IUnknown/IController is not transported across]. Thanks Vivek Ragunathan
Programming is an art, Code is a poem !!!
-
There are various components beside the main component and the main component is responsible for providing access to the other components. Hence a GetInterface.
Programming is an art, Code is a poem !!!