Jump to content
  • Advertisement
Sign in to follow this  
DrSuperSocks

Should I compile dependencies with my API?

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

So, I've been writing a game engine for a while now alongside several hobby games. It gets developed as each game needs it to have more features. I'm now in the process of refactoring the code and cleaning up the project.

 

It depends on all sorts of fun things, like glew, SFML, CEGUI, and Box2D. As of now, I compile all of my dependencies with the API so as to have just one .a file to link with. I realize that doing this doesn't really dodge all of the bullets, since I still have to point to all of the headers of my dependencies.

 

So, my question - should I continue to compile my dependencies with my API, or should I leave it up to the user to link the dependencies?

 

EDIT: I'm asking about best practices, because I've seen a lot of different APIs do it both ways.

Edited by DrSuperSocks

Share this post


Link to post
Share on other sites
Advertisement

Here's a question to ponder over: What happens when someone links your library AND one of its dependencies? They may be using Box2D explicitly for something else, for example. Versions may not match. If you're exporting your dependencies' symbols, things will collide at link time and that can be very obnoxious. 

Edited by Promit

Share this post


Link to post
Share on other sites

A very good point. I can't believe something that obvious never occurred to me. I'll rip apart my convenient .a file and keep everything separate. Thanks!

Share this post


Link to post
Share on other sites

You might want to check the license agreements for each of those libraries. Some licences explicitly specify that you need to link in a certain way, so that someone else can relink your code with a different version of the library.

 

For example LGPL requires that you either:

 

  • 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
  • 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
Edited by Adam_42

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.

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!