David,
> __declspec(dllexport) int __stdcall ExecuteCallback(int (*
>pFunction)(int), int val)
If you can modify the C source, you should change
int (*pFunction)(int)
to
int (__stdcall *pFunction)(int)
> [DllImport("CallbackDll.dll", CallingConvention=CallingConvention.StdCall)]
> public static extern Int32 ExecuteCallback(IntPtr pFunction, Int32 val2);
Change the first parameter type to CallbackDelegate. The runtime takes
care of marshaling it to a function pointer.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.