我有一个库(C++),它有一些API函数。其中之一被声明为__cdecl,但是从__stdcall获取函数poiner。喜欢的东西: typedef int (__stdcall *Func)(unsigned char* buffer);
//...
int ApiFunc(Func funcPtr); //This is __cdecl since it is an 'extern "C"
为什么Foo()成功,但Bar()会抛出BadImageFormatException? using System.Runtime.InteropServices;
using System.Text;
static class Program
{
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cde