After searching and experimentation, I found the note in the remarks section
of the MSDN doc on Marshal::GetDelegateForFunctionPointer
(http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.
getdelegateforfunctionpointer.aspx) -
You cannot use this method with function pointers obtained through C++...
Why not?
SvenC - 21 Oct 2006 16:21 GMT
Hi,
> After searching and experimentation, I found the note in the remarks
> section
[quoted text clipped - 6 lines]
>
> Why not?
I guess the documentation is talking about class function pointers. Native
function pointers and class function pointers are of different size and need
different code to be called so they are not compatible.
--
SvenC
Ben Voigt - 07 Nov 2006 20:46 GMT
> After searching and experimentation, I found the note in the remarks
> section
[quoted text clipped - 6 lines]
>
> Why not?
Calling convention, I would guess. That method probably assumes stdcall,
while C++ uses thiscall except for variable length argument lists which use
cdecl.
It also mentions that you can't use a function pointer to a managed method,
and if you compile your C++ code with /clr then chances are your C++
functions are MSIL (managed).