N
Norman Diamond
Using VS2005 SP1, I have a C++ COM DLL and a C# client.
If the C++ and MIDL source use type INT_PTR and the C# client uses type
IntPtr, then the result works in x86 (32 bit) but doesn't compile in x64
(64-bit). The C# compiler gives error messages like
Error CS1503: Parameter '6': cannot convert from 'out System.IntPtr'
to 'out long'.
MSDN suggests that the C++ and MIDL source should use type void* instead.
http://msdn2.microsoft.com/en-us/library/sak564ww.aspx
* COM value type COM reference type System type
* void * void ** System.IntPtr
This MSDN page does not mention native type INT_PTR at all, it says void*.
I couldn't imagine what difference it would make, but I still can't find any
other solution, so I obeyed this page. Now the MIDL compiler gives error
messages like
error MIDL2139: type of the parameter cannot derive from void or void *
Does anyone know how to do COM interop in x64?
If the C++ and MIDL source use type INT_PTR and the C# client uses type
IntPtr, then the result works in x86 (32 bit) but doesn't compile in x64
(64-bit). The C# compiler gives error messages like
Error CS1503: Parameter '6': cannot convert from 'out System.IntPtr'
to 'out long'.
MSDN suggests that the C++ and MIDL source should use type void* instead.
http://msdn2.microsoft.com/en-us/library/sak564ww.aspx
* COM value type COM reference type System type
* void * void ** System.IntPtr
This MSDN page does not mention native type INT_PTR at all, it says void*.
I couldn't imagine what difference it would make, but I still can't find any
other solution, so I obeyed this page. Now the MIDL compiler gives error
messages like
error MIDL2139: type of the parameter cannot derive from void or void *
Does anyone know how to do COM interop in x64?