我如何使用__cdecl调用约定编译提升? [英] How do I compile boost using __cdecl calling convention?

查看:259
本文介绍了我如何使用__cdecl调用约定编译提升?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

__ CDECL 使用编译项目调用约定(msvc2010),我使用相同的编译器使用默认设置编译的推动作用。

I have a project compiled using __cdecl calling convention (msvc2010) and I compiled boost using the same compiler using the default settings.

该项目以提振联系,但我在运行时我得到了这样的断言消息:
文件:... \\提升\\提升\\ program_options \\详细\\ parsers.hpp
行:79

The project linked with boost but I at runtime I got an assert message like this: File: ...\boost\boost\program_options\detail\parsers.hpp Line: 79

运行时检查失败#0 - ESP的值未正确保存跨函数调用。这通常是调用带有一个不同的调用约定声明的函数指针执行调用约定声明的函数的结果。

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.

有以下几个问题:


  • 什么调用约定并在默认情况下Windows上(msvc2010)
  • 促进建立与
  • 怎么我编译加强与__cdecl调用约定

  • 为什么升压无法prevent与code有不同的调用约定链接?我了解,推动具有真正聪明的库自动列入code。

看起来是升压并在运行时编译和正确调用约定的链接,我还是得到了上述问题。我没有使用相同的code一个示例应用程序和它的作品,但在我的应用程序失败。唯一的区别可能是从项目配置或包含/ stdafx.h中

It looks that boost does compile and link with proper calling convention, still at runtime I get the above problem. I did a sample application using the same code and it works but in my application it fails. The only difference could be from project configuration or includes/stdafx.h

推荐答案

我发现这个问题的原因里面的共享属性文件之一:< StructMemberAlignment> 4字节< / StructMemberAlignment>

I found the cause of the problem inside one of the shared property files: <StructMemberAlignment>4Bytes</StructMemberAlignment>

如果我删除它code会工作。不过,我不知道为什么发生这种情况,我怎么能解决而不删除上述code(认为需要由其他库)。

If I remove it the code will work. Still, I'm not sure why this is happening and how could I solve it without removing the above code (that was required by another library).

我添加关于另外一个问题<一href=\"http://stackoverflow.com/questions/2711732/should-boost-library-be-dependent-on-structure-member-alignments\">boost和结构成员对齐。

I added another question regarding boost and structure member alignment.

这篇关于我如何使用__cdecl调用约定编译提升?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆