How do I pass an IUnknown** pointer from C++ COM to C#

  • Thread starter Thread starter Jy_13
  • Start date Start date
J

Jy_13

Guest
Hi,

I need to pass an IUnknown** pointer to a C# module through COM interop. I can add a method in an interface to on the C# side to handle this. The question is how do I handle it on the C# side

For example, from the C++ COM side I have access to the C# module through some interface, say m_pMyInterface:

Also, this IUnknown interface pointer is actually some other interface which derives from IUnknown, say IProgInterace.

IUnknown** pUnknown = <some_value>;

m_pMyInterface->MyMethod(pUnknown);

How do I handle this parameter in C#? Should it be an IntPtr, and if so how do I convert it back to the desired interface (IProgInterface) to call its methods?

TIA,

Jy

Continue reading...
 
Back
Top