2012-10-18 41 views
2

我定義的函數的C++/CLI庫:在C++/CLI調用約定

extern "C" 
{ 
    INT_PTR __cdecl brl_graphics_Graphics(int Width, int Height, int Depth, int Hertz, int Flags); 
} 

這是調用它的功能,它只是一個包裝:

IntPtr BlitzMax::BlitzMax::Graphics(int Width, int Height, int Depth, int Hertz, int Flags) 
{ 
    return IntPtr(brl_graphics_Graphics(Width, Height, Depth, Hertz, Flags)); 
} 

當我把它從C#應用程序,我得到一個AccessViolationException,由於某種原因,在不cdecl調用約定使用拆卸:

push  dword ptr [ebp+10h] 
push  dword ptr [ebp+0Ch] 
push  dword ptr [ebp+8] 
mov   ecx,dword ptr [ebp-4] 
mov   edx,dword ptr [ebp-8] 
call  FFD595B8 

回答