Hi,
感谢在MSDN论坛发帖。
据我所知,非托管的代码之所以能在托管代码中运行,得益于元数据的作用。
CLR会把非托管中的数据,函数都会暴露出来,对于数据使用marsh的。 你这个直接定义,都没有marsh,会不会导致这个错误。
从MSDN的官网中,在非托管的代码中,定义的回调函数,是没有带参数的。
typedef void (__stdcall *PFN_MYCALLBACK)();
int __stdcall MyFunction(PFN_ MYCALLBACK callback);
我建议你应该先marsh这个数据,然后传递给回调函数。
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints
to MSDN Support, feel free to contact MSDNFSF@microsoft.com.