Jump to content
  • Advertisement
Sign in to follow this  
transformation

If you compile lib A using lib B, then do you have to include both or is lib A enough

This topic is 4889 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

I was just wondering, if you have a bunch of static projects. Say you have the following libs: CoreLib, MathLib, IOLib, GraphicsLib, Now the IOLib and the MathLib both use the CoreLib. The GraphicsLib uses all 3 other libs. If I create a project and link in the graphics lib, would that be enough or do I have to link in all other libs? Because I've noticed that even when teh graphics lib was empty, (no clases implemented yet), it still had the size of all the other 3 libs combined. So if I ditribute just the GraphicsLib and all the header files, will it still work? And I get a bunch of warnings when the graphics lib is compiled, warnings that say: "Core::SomeFunction already defined in MathLib: second definition ignored". Should I worry about those or not? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
don't quote me on this but i think you need to include every lib that you will be using, I don't think that it is like include statement but i could be wrong.

Share this post


Link to post
Share on other sites
I'm 99% sure that the code in .lib files gets compiled INTO your executable. So you don't need the executable is built. So if you compile lib B and it needs lib A to run, all the parts of lib A that are needed are copied into lib B.

That's why when your final project includes both lib A and lib B, there are namespace collisions because for any functions that B uses from A, you have two identical definitions. Seems to me that a smart linker would realize that they are both the same, and in any case it doesn't matter if it successfully compiles.

my 2c.

Share this post


Link to post
Share on other sites
Try removing the some of the libs from the compiled test project and see if it asks for the DLL to be included in the executable directory.

Share this post


Link to post
Share on other sites
oh Im a 100% sure that code from static libs get compiled directly into the exe. BTW these are statically linked libs I'm talking about - Im just wasnt a 100% sure that code from static libs get compiled directly into other static libs. Though thanks to Rob, that's how it is.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!