Jump to content
  • Advertisement
Sign in to follow this  
3DModelerMan

Linking libraries into libraries

This topic is 2500 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'm trying to write an engine that depends on a bunch of libraries. The engine is a static library that I will link my games and editor to. The problem is that when I go to link an application to it; I end up hving to link tha aplication to all the engine's dependencies. What I want is to just be abl to link to my engine, and my engine would have the libraries all compiled in. Is there any way to do this with static libs? If I just compiled my engine as a dll would that take care of the problem?

Share this post


Link to post
Share on other sites
Advertisement
I tried and it didn't work when I set it to link library dependencies. Even if I tried a DLL. How do most engines handle dependenies on other libraries?

Share this post


Link to post
Share on other sites

I tried and it didn't work when I set it to link library dependencies. Even if I tried a DLL. How do most engines handle dependenies on other libraries?


With 2-3 hours of the lead programmer's time spent setting up the project on the junior's pc. That's generally the go...

Share this post


Link to post
Share on other sites
The problem is that when I go to link an application to it; I end up hving to link tha aplication to all the engine's dependencies.
If you're using a meta-build system, then it should be able to do this for you.
I'm using CMake, and I can simply say "engine depends on foo" and "app depends on engine", with the result that the 'app' project is created containing 'engine' and 'foo' as linker inputs.

Share this post


Link to post
Share on other sites
I tried adding the engine's dependencies to the premake file and it worked fine until I tried to link to the engine externally from my test app. Would it be a bad idea to link the engine using #pragma in the engine headers? That way it would automatically link to the engine when you included the headers, and it wouldn't link to modules you didn't need. Are there any problems with that approach? And are there any commands similar to #pragma on GCC and other platforms like Linux?

Share this post


Link to post
Share on other sites
I've not used premake, but hopefully there's just a slightly different way of using it that does this correctly. I know I had the same issue originally with CMake (where my library's dependencies weren't propagating to users of my library), but eventually figured out I was writing my scripts a bit wrong...
You might find some good advice on the premake mailing list or forum.
And are there any commands similar to [font=courier new,courier,monospace]#pragma link[/font] on GCC and other platforms like Linux?
No, because it's bad and wrong wink.png The compilation system was designed such that it's a nonsense idea that an individual translation unit (compiled file) is be able to configure the inputs to the entire linking step... even though it is a convenient feature, and obviously possible to implement seeing as MSVC allows it tongue.png

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!