[Mono-list] How to call a C++ interface class?

Marcus mathpup@mylinuxisp.com
Mon, 12 May 2003 23:33:06 -0500


I'm not entirely clear on what you are trying to do. Could you be more 
specific?

Coincidentally, last night I was looking for information about that very 
function, but I was not able to find much at all. In fact, what I found was 
that other people did not understand how to use that method. Also, Mono and 
Portable.NET do not implement that method, so that is not an option, either.



On Monday 12 May 2003 2:59 pm, J. Perkins wrote:
> I have unmanaged DLL that returns a C++ interface, which is a struct
> containing only virtual functions. It's nVidia's CgFX library, in case
> anyone cares, and it looks like so...
>
> struct ICgFXBaseEffect
> {
> 	virtual ULONG AddRef() = 0;
> 	virtual ULONG Release() = 0;
>
> 	virtual HRESULT GetDesc(CgFXEFFECT_DESC* pDesc) = 0;
> 	virtual HRESULT GetParameterDesc(LPCSTR pParameter, CgFXPARAMETER_DESC*
> pDesc) = 0;
> 	...
> }
>
> I was thinking that I might be able to represent this in C# as a struct
> of IntPtrs, then call Marshal.GetManagedThunkForUnmanagedMethodPtr() to
> wrap the IntPtrs with C# methods. However, I can't find any examples of
> how to use this function, so I'm at a bit of a loss. Can any help me out
> here? Am I on the right path? Has anyone used this call before, and if
> so how does it work? In particular, how do you get an IntPtr to a method
> signature?
>
> Thanks for the help, much appreciated.
>
> Jason
> 379
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list