Page 1 of 1

Can a .lib work for multiple versions of VC++?

Posted: Thu Feb 17, 2005 6:56 am
by Clay
Can a .lib file work for VC++ 6, 7, and 7.1? Or does it only work for the compiler you are compiling with?

I am working on a library for ogre that can only be compiled using VC++ 7.1 (there's no way to get around this), but I'd like you to be able to use the library from any VC++ >=6. None of the interface is VC++ 7.1 specific, but the internals of the library are.

I have a good feeling that you can do this so that it works with everything, but why does Ogre have different dependancy releases for different compilers, and will Ogre 1.0.0 sdk be VC++ version specific?

---

In ~7 days I'm going to post something that'll knock your socks off. Mark your calendar. =)

Posted: Thu Feb 17, 2005 7:26 am
by monster
Can a .lib file work for VC++ 6, 7, and 7.1? Or does it only work for the compiler you are compiling with?

I believe they're upwardly compatible, so that one created in VC6 will work in VC7 and VC7.1. One created in VC7 will work in VC7.1 but not in VC6, and one created in VC7.1 might work in VC7, but probably won't work in VC6. If you see what I mean.

There is a reason why there are different dependency releases for the different versions of MSVC, but I can't remember what that reason is! Hang on I'll have a look around.
In ~7 days I'm going to post something that'll knock your socks off.
Oooh! Can't wait!

Posted: Thu Feb 17, 2005 7:29 am
by monster
Ah, yes, here we are;
http://www.ogre3d.org/phpBB2/viewtopic.php?t=7758
I only need CEGui because the rest of the deps I'm building for VC7.0 will work with VC7.1 too. CEGui won't because it uses STL, and VC7.0 needs to be built with STLport whilst VC7.1 does not, so binaries won't play nice together.

So, nothing to do with library versions. Maybe they will all work nicely together?

Posted: Thu Feb 17, 2005 7:45 am
by Clay
Ahhh ok. So it looks like if I build a version with stlport (for older VC++) and a version with stlport I should be good to go then. Thanks!

Posted: Thu Feb 17, 2005 11:40 am
by :wumpus:
VC8 is an exception to this; even some plain C libs compiled for VC6 or VC71 (like zzliplib) will give unexpected results in VC8.
Might be because it's a beta, but still.

Posted: Thu Feb 17, 2005 2:31 pm
by sinbad
Unfortunately you can't often use libs compiled with VC7 with VC6; the reason is that the runtime library changed and VC7 generates calls to a floating-point routine which does not exist in VC6 (I forget the name). Therefore VC7 libs are unlikely to work in VC6.

Posted: Thu Feb 17, 2005 5:10 pm
by Clay
Do you think that VC 7.1 would work with VC 7 (in general)?

Posted: Thu Feb 17, 2005 6:20 pm
by sinbad
If you compile with STLport, yes.

Posted: Thu Feb 17, 2005 11:44 pm
by PeterNewman
I've also seen name decoration (mangling) change between versions of compilers, especially when updating the compiler (say from VS7 to the 2003 optimizing) and not doing a clean build. But I have no clear evidences.

I dont know if it applies to .LIB, but it definately applies to DLL's that have exports that are not extern "C".