Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About Fireborn

  • Rank

Personal Information

  • Interests
  1. It's been awhile since i put together a project from scratch and realized I don't actually understand enough about static and dynamic libraries. I'm having a bit of trouble sussing out the confusion through google so I was hoping someone here could sort me out. My game logic is broken up into 3 libraries: GameCommon GameClient (references GameCommon and implements client versions of classes) GameServer (references GameCommon and implements server versions of classes) Since the server doesn't need to do any rendering, I'm breaking up my engine into two libraries: Engine EngineRender (references Engine) So theoretically my game client executable will leverage the GameClient, GameCommon, Engine, and EngineRender libraries. Here are some of the questions I'm struggling with in regards to building that game client executable: When compiling the above libraries as static, I thought the linking step would happen once at the very end when building the actual executable. As a result I set up my executable project to link in the 4 static libs it needed. I was surprised to see unresolved external errors reported from the GameClient library project when using functionality from the Engine library. I hadn't set up the GameClient library to explicitly reference (or link?) against the Engine library based on my initial assumption - I figured the library would just carry on with it's build and any holes in functionality would surface down the road when linking the executable. Since that initial assumption seems wrong, does that instead mean that I ought to have the GameClient library link in the Engine library somehow? Should I then assume all of the Engine library content will be inside the GameClient .lib file, or does the game executable still need to link against both GameClient.lib and Engine.lib? As a followup to question 1, if my executable only has to link against GameClient.lib and EngineRender.lib, does that mean I'm effectively pulling in two copies of Engine.lib since both GameClient and EngineRender will have to link against Engine.lib? For some reason I thought static and dynamic libraries had some high level differences but were basically interchangeable if you weren't doing anything fancy. Swapping my libraries above from static .lib files to dynamic .dll files started causing some unresolved external issues though. From reading around I think this is because my GameClient library is trying to use functions from Engine library which I haven't explicitly marked up as dllexport? I feel like I have worked on .dll libraries in various projects over the years and don't have any recollection of having to meticulously manage exporting the functionality I added, but maybe I'm mistaken and this is just a huge hole in my understanding of how .dll's work? Does swapping from static to dynamic libraries impact the answers to questions 1 and 2 above? I loosely thought the way .dll's worked was that as the executable started it would try to find the functionality it needed across the various .dll files in the directory with it and would fail to start if it didn't find what it needed. Based on what I was seeing in question 3, it's looking like there is still some kind of linking that happens when generating the libraries and/or executables that detects when a function used from a .dll doesn't have an implementation, but maybe I'm still misunderstanding something? Thanks in advance for any help anyone can provide in clarifying this stuff in my head!!
  • 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!