`

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)”提示了我们在64位操作系统中尝试使用plSQL Developer工具与Oracle数据库建立连接时遇到的一个常见问题,即SQLNet配置不正确。...

    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 ...

    swt资源释放问题

    需要注意的是,一个线程中不能同时有两个活动的 Display 实例存在,否则程序运行时会抛出一个 SWT 异常。如果需要创建多个同时活动的 Display 实例必须在不同的线程中创建它们,并使用 Display 的 getCurrent 函数...

    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...

    曲线拟合工具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...

    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 ...

    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 ...

    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 ...

    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 ...

    解决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目录...

    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 ....

    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...

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

    ORA-00933: SQL command not properly ended ``` 解决方法是确保SQL语句完整无误,并使用正确的语法进行删除操作。 #### 四、总结 Oracle的回收站功能为用户提供了一个方便的方式来管理数据库对象的删除与恢复,极...

    数字信号处理英文版:Ch7 LTI Discrete-Time Systems in the Transform Domain

    A transfer function characterizes the behavior of a system in the frequency domain by describing how input signals are transformed into output signals. It can be classified based on the duration of ...

    polycom宝利通视频会议软件3.9 2018

    “GUEST” means a third party conference call participant invited to a conference call by a USER and who does not fit the definition of USER. GUESTS may not create or manage meetings on behalf of your...

Global site tag (gtag.js) - Google Analytics