views:

1194

answers:

2

(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?

+3  A: 

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() )
 }
Christopher
+2  A: 

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.

Dan Cristoloveanu
Yes, i meant the linker. :)
Klaim