我在调用Delphi编写的动态库时,无论传入什么类型的参数在C++运行时系统都会提示Run-Time Check Failure #0,全文内容如下:Run-Time Check Failure #0- The value of ESP was not properly saved across a function call.This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention。请教各位高手,这个问题如何解决?谢谢
解决方案 »
- 有关delphi调用外部程序winexec,外部程序等待输入,如何自动结束?
- ●●●求助●●● 关于提取数据库中的最后一个记录
- 文件读写遇到的问题Reset(f,1) BlockRead()
- 很简单,SHOWMODAL问题。进来都有分。onlin waiting....e
- 如何取出dbgrideh1中footer column中的值啊?
- 請問各位:Create與CreateWnd的區別?
- 怎樣在一台電腦上裝兩片顯卡
- 动画文件的格式
- Delphi可以用来开发B\S模式吗???
- 我现在需要作安装程序?
- 急! ! ! !急! ! ! !急! ! ! !使文档里的内容显示到RichEdit里.
- 谁能帮我看看这个API函数的参数这么用啊?
是 調用方式不一致 stdcall or cdecl...
function dTest(str:PChar):PChar;stdcall;
function dTest(str:PChar):PChar; //str:pchar str:Integer
var
ss : string;
begin
ss := str;
ShowMessage(ss);
Result := PChar('This is a test!');
end;
通过showmessage函数显示传入函数的字符串,没有问题,但是系统执行后弹出错误信息对话框,提示上述错误。
C++中的程序为
typedef LPCSTR(_cdecl *Connect)(LPCSTR s);
HINSTANCE hinstDLL=NULL;
hinstDLL=LoadLibrary("../dllTest.dll");
if (hinstDLL)
{
Connect Proc;
char p[100] ;
CString csTemp;
p[99] = '\0';
Proc = (Connect)GetProcAddress (hinstDLL,"dTest");
LPCSTR iValue;//int
CString str;
str.Format("This is a test");
LPCSTR sss = "abcxsw";
iValue = Proc(sss);//m_i str
strncpy(p,iValue,100);
csTemp.Format(p);
FreeLibrary(hinstDLL); AfxMessageBox(p);
}
else
{
AfxMessageBox("没找到dll");
}
帮帮忙,谢谢,不知道如何解决。
typedef LPCSTR(_stdcall *Connect)(LPCSTR s);
function dTest(str:PChar):PChar;cdecl;type PTestFunc = function(str:PChar):PChar; cdecl;