Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

Library formats

This topic is 2351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Visual C++ uses libraries in the .lib format, whereas all the GCC compilers use .a for there libraries. The formats are different, and I was wondering if anybody knew a way to convert between the two, or at least use the .libs with MingW32

------------------
LoungePig
OpenGUI

Share this post


Link to post
Share on other sites
Advertisement
Even if it was possible, I don't think code would be compatible between VS and GCC. Lots of [b]implementation[/b] of C++ is compiler-dependant (like the way they handle function pointers for example).

Share this post


Link to post
Share on other sites
MinGW and VC++ use the same library format. Really, open them up in a text editor. I was surprised to find this out myself.

Part of libz.a installed by MinGW (albiet back in the GCC 4.1 days):
[CODE]
!<arch>
/ 1264731646 0 0 0 1192 `
[/CODE]

Part of zlib.lib compiled by VC++2010 yesterday:
[CODE]
!<arch>
/ 1336440513 0 5418 `
[/CODE]

The archiver (ar) basically acts the same when "ar p [libfile]" for both of them.

I seem to remember that MinGW was written to be compatible with VS libraries on a code level, but that was a while back so I could be misremembering, and even if I'm not they could have ditched that. Easy way to try, though; just link a VS-compiled lib to a GCC project and see if it runs.

Edit: I just realized that while the archive formats are the same, the object files contained within are most likely different, preventing them from linking with the alternative toolchain.

Share this post


Link to post
Share on other sites

This topic is 2351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!