`

the value of esp was not properly saved across a function call异常

    博客分类:
  • COM+
 
阅读更多

解决方式有三种:

 

1. 若模块有更新,首先检查该更新模块的dll是否在调用者的DEBUG目录下,若不在,复制dll文件到此DEBUG目录下即可。

 

2. 在函数调用前加入 WINAPI

 

3. 调用DLL函数,出现错误

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.

 

错误原因:

定义函数指针原型时出错。

其实你定义的没有错,但是编译器不认识而已,因为你调用的dll函数是一个远函数,而且是一个C函数,你得告诉编译器它是个c函数才行。那么你就可以在定义该函数的时候加上一句话,

FAR PASCAL 或者 __stdcall 这个就OK了。

具体做法:

比如说你要定义一个 返回类型为空,参数为空的函数指针:

typedef void (*LPFUN)(void);

这样确实跟我们dll里的函数匹配了,上面也说了,我们应该添上几个字,告诉编译器这个是一个远的C函数。

typedef void (WINAPI *LPFUN)(void);

typedef void (__stdcall *LPFUN)(void);

typedef void    (FAR PASCAL *LPFUN)    (void);

像上面这样定义就OK了,如果用的是VC++,那么直接用第一种定义就ok了。

注意,上面是使用 MFC (DLL)的做法。

如果是WIN32 DLL,得相应的去掉WINAPI ,__stdcall ,FAR PASCAL 这几个参数。因为WIN32 DLL 默认的入栈方式为 __cedcall方式,不是__stdcall方式。

 

具体的组合方式太多了,反正知道错误的原因是声明相应的函数未匹配就行了。 

 

 

0
0
分享到:
评论

相关推荐

    在64位机器上使用plSQL连接Oracle的问题(SQLNet not properly installed)

    在64位机器上使用plSQL连接Oracle的问题(SQLNet not properly installed)

    The irrationals: a story of the numbers you can't count on

    The ancient Greeks discovered them, but it wasn't until the nineteenth century that irrational numbers were properly understood and rigorously defined, and even today not all their mysteries have been...

    S7A驱动720版本

    - When the signal conditioning function "S&M" was used for a byte value, the driver wrote wrong values to the PLC. Build 223 : New Functions: - The number of supported NetLinks has been ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    This was not handled properly, so if a call was made to VsOpen when no VariSpec was present, but a later call was made when a filter was present, the latter would fail. b) VsGui added check of which...

    The Art of Memory Forensic

    The next era of malware and security breaches are more sophisticated and targeted, and the volatile memory of a computer is often overlooked or destroyed as part of the incident response process. The ...

    曲线拟合工具CurveExpert 1.0

    + The the graph of a polynomial fit would be reset if the data was changed in the data window. Fixed. + The scaling procedure did not grab the latest data out of the data window's edit control if...

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click ...

    VclZip pro v3.10.1

    - If a file does not extend beyond any of the original limitations (filesizes of 4 gig or 65535 files) then no Zip64 format information is included in the archive. - property isZip64 - tells you when ...

    swt资源释放问题

    swt资源释放问题,详细介绍swt如何释放屏幕资源

    Sakemail

    A obscure bug was found by HuangYeJun from china, in the RetrieveHeaders function if the retrieved text was larger than 1024 bytes and the crlf.crlf fall in the middle of two chunks, the function is ...

    BobBuilder_app

    I decided against using SortedDictionary for the pages as it was slower than a normal Dictionary and for the purpose of a key value store the sorted-ness was not need and could be handled in other ...

    CE中文版-启点CE过NP中文.exe

    Fixed not adding the 0-terminator to strings when the option was set to add it Fixed ultimap hotkeys Fixed ultimap2 filtering Changing pointers in the change address dialog won't set/override global ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    The definition of an inline function needs to be in a header file, so that the compiler has the definition available for inlining at the call sites. However, implementation code properly belongs in ....

    acpi控制笔记本风扇转速

    Fixed a problem where the presence of the _OSI predefined control method within complex expressions could cause an internal compiler error. AcpiExec: Implemented full region support for multiple ...

    Oracle 回收站功能,彻底删除表ORA-00933:SQL command not properly ended

    Oracle 回收站功能,彻底删除表ORA-00933:SQL command not properly ended,由于删除触发器引起的。数据交换不能再建触发器。

    A tour of git_the basics

    As this is a modified version, the name of Bryan O'Sullivan is used only to properly credit him with the original text. The appearance of his name here explicitly does not assert or imply his ...

    VisualRoute is not installed properly 解决办法

    visualroute 2010 在使用eclvr14c进行破解时,提示"VisualRoute is not installed properly ",经本人多次跟踪实践发现问题在缺少文件上: 检查安装完后在C:\Documents and Settings\Administrator\下是否有mswin32v16....

    Universal-USB-Installer

    The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus...

    解决Delphi DBX和MySQL连接的噩梦:DBX Error: Driver could not be properly initialized.

    (DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, ...),我找到了合适的libmysql.dll和dbxmys.dll组合,把下面这个libmysql.dll拷贝到XE的bin目录...

    A study of peer-to-peer botnets 国外的一片硕士论文

    Systems not properly secured may potentially become part of a botnet army, while all systems are potential targets of a botnet attack. Two important facets in mitigating the threat are the detection ...

Global site tag (gtag.js) - Google Analytics