简体   繁体   English

本地多目标化会以何种方式影响构建的输出

[英]In what ways does native multi-targeting affect the output of a build

I have a large solution made from a combination of c++ and c# projects, most of which output dll's. 我有一个由c ++和c#项目组合而成的大型解决方案,其中大多数输出​​dll。 We also have an executable which depends on the outputs from those projects. 我们还有一个可执行文件,取决于这些项目的输出。 Our entire solution is currently built in VS2005. 我们的整个解决方案当前是在VS2005中构建的。 For numerous reasons we have to target v80 for our builds, but we've finally found time to move to the 2010 IDE. 出于多种原因,我们必须将v80作为构建目标,但我们终于找到了转移到2010 IDE的时间。

When we build in 2010, our solution all compiles fine, but we get an access violation when running the app. 当我们在2010年进行构建时,我们的解决方案都可以正常编译,但是在运行应用程序时遇到访问冲突。 This exception occurs in a number of scenarios, but always at the same point in code - It also shows as an "exception encountered during a user callback". 在许多情况下都会发生此异常,但是总是在代码中同时发生-它也显示为“用户回调期间遇到的异常”。 If we edit out the line of code where the exception throws, it simply moves to somewhere else, which makes sense. 如果我们将抛出异常的代码行编辑掉,它只会移动到其他地方,这很有意义。 The scenario's in which we have the issue are as follows: 问题所在的场景如下:

All dll's and exe built in 2010 against the v80 toolset. 所有dll和exe均针对v80工具集于2010年构建。 All dll's build in 2005, exe built in 2010 against the v80 toolset. 所有dll的版本都建立于2005年,exe的版本则是针对v80工具集构建于2010年。

Notably though, if we use the dll's built in 2010 (against v80) but the exe built in 2005, everything works fine. 值得注意的是,如果我们使用2010年内置的dll(针对v80),但使用2005年内置的exe,则一切正常。

My question then is: What is the difference between the output from a build in 2005 and the output from a build in 2010 using the v80 toolset? 那么我的问题是:使用v80工具集的2005年版本的输出与2010年版本的输出之间有什么区别?

The above is probably dependent on whether it is possible to exactly match the commandline arguments for the build (ie, c++ and linker configuration) as it may be we haven't quite got those right. 上面的内容可能取决于是否可以完全匹配构建的命令行参数(即c ++和链接器配置),因为我们可能还没有完全正确。 If needed I can link the settings from 2005 and those from 2010. 如果需要,我可以链接2005年和2010年的设置。

Any help would be much appreciated. 任何帮助将非常感激。

UPDATE: I've recently created a very simple application in 2005, consisting of a dll and exe. 更新:我最近在2005年创建了一个非常简单的应用程序,由dll和exe组成。 The dll has a function static __declspec(dllexport) int add(int a, int b). 该dll具有静态__declspec(dllexport)int add(int a,int b)函数。 The exe is a simple console application which calls the add function from the dll. exe是一个简单的控制台应用程序,可从dll调用添加功能。

I then ported this to VS2010 and set it to the v80 toolset. 然后,我将其移植到VS2010并将其设置为v80工具集。 Building this produces a dll with the same size as the original, the exe however is 4KB bigger. 构建此文件会生成一个与原始文件大小相同的dll,但是exe的大小要大4KB。 I'm using dumpbin to try and find out why, but I don't know it too well at the minute. 我正在使用dumpbin尝试找出原因,但是目前我还不太清楚。 If anyone else can identify in this simple case why the exe's are different sizes, this may help solve my overall problem 如果其他任何人都可以在这种简单情况下确定exe大小不同的原因,则可能有助于解决我的整体问题

Solved this now, the issue was caused by DEP being turned on by default. 现在已解决此问题,此问题是由默认情况下启用的DEP引起的。 I can confirm for anyone else though that the output from the builds should and will match exactly if you use the same compiler and linker settings. 我可以为其他任何人确认,如果您使用相同的编译器和链接器设置,则生成的输出应该并且将完全匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM