delphi写的dll VC中调用报错。该怎么解决

delphi写的dll VC中调用报错。
delphi中一个很简单的函数:
function GetMaxVal(BmpFile: PChar) : Integer;
begin
  Result := 10;
end;

vc中:
typedef int(*GetMaxVal)(PCHAR path);

HINSTANCE handle = LoadLibrary("xxx.dll");

GetMaxVal gv;

gv = (GetMaxVal)GetProcAddress(handle,"GetMaxVal");

char *path = new char[128];
memset(path, 0, 128);
strcpy(path, "c:\\3.bmp");
int kk = gv(path);

出来一个终止,重试,忽略的报错框:
file:i386\chkesp.c
Line:42

The value of esp was not proerly saved across a function all.................


如果把delphi中的函数的PChar参数去掉,就能正常调用。

------解决方案--------------------
GetMaxVal指定为stdcall调用约定了吗
------解决方案--------------------
没看到你代码里的stdcall似的
------解决方案--------------------
探讨
引用:
GetMaxVal指定为stdcall调用约定了吗


指定了。

------解决方案--------------------
100%是这个原因

function GetMaxVal(BmpFile: PChar) : Integer; stdcall;

vc中:
typedef __stdcall int(*GetMaxVal)(PCHAR path);