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 pointer declared with a different calling convention.

This debug error means that the stack pointer register is not returned to its original value after the function call, i.e. that the number of pushes before the function call were not followed by the equal number of pops after the call.

There are 2 reasons for this that I know (both with dynamically loaded libraries). #1 is what VC++ is describing in the error message, but I don't think this is the most often cause of the error (see #2).

1) Mismatched calling conventions:

The caller and the callee do not have a proper agreement on who is going to do what. For example, if you're calling a DLL function that is _stdcall, but you for some reason have it declared as a _cdecl (default in VC++) in your call. This would happen a lot if you're using different languages in different modules etc.

You would have to inspect the declaration of the offending function, and make sure it is not declared twice, and differently.

2) Mismatched types:

The caller and the callee are not compiled with the same types. For example, a common header defines the types in the API and has recently changed, and one module was recompiled, but the other was not--i.e. some types may have a different size in the caller and in the callee.

In that case, the caller pushes the arguments of one size, but the callee (if you're using _stdcall where the callee cleans the stack) pops the different size. The ESP is not, thus, returned to the correct value.

(Of course, these arguments, and others below them, would seem garbled in the called function, but sometimes you can survive that without a visible crash.)

If you have access to all the code, simply recompile it.

Run-Time Check Failure #0的更多相关文章

  1. C++程序在debug模式下遇到Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call问题。

    今天遇到一个Access Violation的crash,只看crash call stack没有找到更多的线索,于是在debug模式下又跑了一遍,遇到了如下的一个debug的错误提示框: 这个是什么 ...

  2. Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. 调用函数约定不同

    Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is ...

  3. Run-Time Check Failure #0,The value of ESP was not properly saved 错误解决

    调用DLL函数,出现错误 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function c ...

  4. 【Dll】Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call

    [问题说明]调试动态库导出的函数时遇到的问题 [解决方法]要么加上__stdcall,对应__stdcall:要么去掉__stdcall,对应_cdecl

  5. Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call错误

    我这边新增的接口之后编译,启动debug后提示这个问题, 在网上找了一段时间,感觉各大神说的都好有道理,但是没有作用 so,尝试对整个工程重新编译(理论上只要重新编译修改的文件影响到的地方)

  6. Run-Time Check Failure #2 - Stack around the variable 'ucPriKey' was corrupt

    Run-Time    Check    Failure    #2        一般是栈被破坏,你的代码可能有缓冲区溢出一类的问题. Run-Time Check Failure #2 - Sta ...

  7. VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法

    问题 : 在用VS2008写一段代码,算法都没有问题,但是调试的时候发现出了main之后就报 Stack around the variable 'xxx' was corrupted 的错误,后来发 ...

  8. c++. Run-Time Check Failure #2 - Stack around the variable 'cc' was corrupted.

    Run-Time Check Failure #2 - Stack around the variable 'cc' was corrupted. char cc[1024];   //此处如果索引值 ...

  9. 解决Matlab启动时 " Can't check 9.0 VCRTs The application has failed to start because……" 的错误

    注:转载或引用请注明出处 今天在winserver 2012 r2 上安装matlab 2016b , 安装完成运行时提示: ERROR: Cnn't check 9.0 VCRTs <star ...

随机推荐

  1. JS页面之间传值

    父页面与子页面之间有多种传值的方式: 第一种,通过window.open的方法打开一个新的页面,在新的页面里面通过window.opener来获取对象,以下为实例 父页面: function open ...

  2. Leetcode 之Longest Valid Parentheses(39)

    有一定的难度.用堆栈记录下所有左符的位置,用变量记录下孤立右符的位置. int longestValidParentheses(const string& s) { stack<int& ...

  3. django使用用户名或手机号码登录

    django有自己的认证系统,会自动根据用户名和密码进行验证.如果需要使用用户名或手机登录的话,需要重写django的认证后台,并且设置到配置文件中. 重写django的认证后台 class User ...

  4. linux命令(32):free命令

    1.显示内存使用情况:free  free –g  free –m 2.以总和的形式显示内存的使用信息: free -t 3.周期性的查询内存使用信息:free -s 10

  5. linux命令(7):ipcs/ipcrm命令

    ipcs作用 :查看消息队列(ipcs –q).共享内存(ipcs –m).信号灯(ipcs -s) ipcrm作用 :删除消息队列.共享内存.信号灯 ipcrm使用方式: ipcrm [ -M ke ...

  6. IntelliJ IDEA SpringBoot 使用第三方Tomcat以及部署

    花了半天时间终于成功,记录以备查阅. 一.第三方Tomcat部署 部署部分参考的是:把spring-boot项目部署到tomcat容器中 目标:把spring-boot项目按照平常的web项目一样发布 ...

  7. 《逐梦旅程 WINDOWS游戏编程之从零开始》笔记1——创建窗口&GDI

    第1章 创建窗口 步骤: 窗口类的设计 窗口类的注册 窗口的正式创建 窗口的显示与更新 消息循环体系 窗口过程函数处理消息 1. 设计:使用WNDCLASSEX结构体,这里注意的是C++中的结构体中的 ...

  8. gitlab和github的区别

          先说一下相同点,二者都是基于web的Git仓库,在很大程度上GitLab是仿照GitHub来做的,它们都提供了分享开源项目的平台,为开发团队提供了存储.分享.发布和合作开发项目的中心化云存 ...

  9. ASP.NET MVC 视图学习,纯干货

    最近用MVC专门为自己做了一个网站,用来记录文章心情和日记.加上和同事的一些交流感觉颇深.所以想把13年买的MVC 4高级编程重新看一遍,记录一些东西,以后应该用的到.视图总是被控制器渲染,因为控制器 ...

  10. vue-vuex安装

    npm install vuex --save 然后在package.json文件的 dependencies中就看到有了一个vuex的文件 解释一下 dependencies生产环境它的意思就是上线 ...