VC9 和 VC8 库兼容性

发布于 2024-07-06 08:28:58 字数 465 浏览 7 评论 0原文

(最初的问题是在那里提出的: http://www.ogre3d.org/ phpBB2/viewtopic.php?t=44832

有人问: “虽然我想在 vs2008 (VC9) 中构建所有内容,但 PhysX SDK 是使用 vs2005 (VC8) 构建的。使用所有 vc9 编译的库并与此 vc8 库结合使用,这会导致任何问题吗?”

我回答说,前一天我尝试使用 VC8 生成的 .lib 文件(和 .dll)并将其包含在 vc9 编译的 exe 中,编译器无法打开 .lib 文件。

现在,其他人回答说他们这样做没有任何问题......

我找不到有关 vc9 和 vc8 之间的 lib 兼容性的信息。

所以...帮忙?

(The original question was asked there : http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832 )

Someone asked :
"While I would like to build everything in vs2008 (VC9), the PhysX SDK is built with vs2005 (VC8). Would this cause any problems, using all vc9 compiled libs and used in combination with this vc8 lib?"

I answered that the day before i tried to use a .lib file (and a .dll) generated with VC8 and include it in a vc9 compiled exe, the compiler couldn't open the .lib file.

Now, other answered they did this with no problems....

I can't find the information about lib compatibility between vc9 and vc8.

so... Help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜嗑 2024-07-13 08:28:58

lib 格式为 COFF (http://msdn.microsoft .com/en-us/library/7ykb2k5f(VS.71).aspx),PE格式中也使用COFF。
因此,我希望大多数(如果不是全部)用 vc8 构建的库都可以与 vc9 链接。

然而我在 msdn 上发现了一个线程,其中 MS 似乎不保证用 VC8 编译的库能够与 VC9 很好地链接。 http://social .msdn.microsoft.com/Forums/en-US/vcgeneral/thread/8042a534-aa8b-4f99-81ee-e5ff39ae6e69/

考虑到这2位信息,我得出结论:尽管MS不保证完全 100% 兼容性 我希望在大多数情况下将 vc8 库与 vc9 链接起来可以工作。

希望这可以帮助。
PS你写“编译器无法打开.lib文件。”。 链接器是尝试打开要链接的库的链接器,而不是编译器。

The lib format is COFF (http://msdn.microsoft.com/en-us/library/7ykb2k5f(VS.71).aspx), also COFF is used in the PE format.
Thus I would expect that most if not all libraries built with vc8 to be linkable with vc9.

However I found a thread on msdn where MS seems not to guarantee that the libs compiled with VC8 will link nicely with VC9. http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/8042a534-aa8b-4f99-81ee-e5ff39ae6e69/)

Taking into account this 2 bits of info I would conclude: Although MS does not guarantee the complete 100% compatibility I would expect that in most cases linking a vc8 lib with vc9 to work.

Hope this helps.
P.S. You write "the compiler couldn't open the .lib file.". The linker is the one that tries to open the libraries to be linked, not the compiler.

挽心 2024-07-13 08:28:58

它可以工作,但是在共享 CRT/STL 对象时会遇到问题。

因此,当您在 vc8 库中执行“new”并将其返回给 vc9 函数(该函数又删除该对象)时,您会从删除中获得断言。

 T* funcInVc8Lib()
 {
     return new T();
 }

 void funcInVC9Program()
 {
     T* p = funcInVc8Lib();
     // ...
     delete p; // it should at least assert here (in _CrtIsValidHeapPtr() )
 }

It works, but you get problems when sharing CRT/STL objects.

So when you do a 'new' in a vc8 library and return this to a vc9 function, which in turn deletes this object, you get an assert from delete.

 T* funcInVc8Lib()
 {
     return new T();
 }

 void funcInVC9Program()
 {
     T* p = funcInVc8Lib();
     // ...
     delete p; // it should at least assert here (in _CrtIsValidHeapPtr() )
 }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文