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

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
x 1
Contact:

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

Post 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. =)
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post 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!
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post 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?
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
x 1
Contact:

Post 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!
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post 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.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post 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.
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
x 1
Contact:

Post by Clay »

Do you think that VC 7.1 would work with VC 7 (in general)?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

If you compile with STLport, yes.
User avatar
PeterNewman
Greenskin
Posts: 128
Joined: Mon Jun 21, 2004 2:34 am
Location: Victoria, Australia
Contact:

Post 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".
Post Reply