The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Any posibility of getting staticly linking Windows libraries
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
I like to break my code up into static libraries. For example the engine in in one library, physics in another that link into my game. There's compile/linking issues when there's SDL2 calls in both the game and engine when I enable static linking. Also, I just don't being the distributor of other people dll's.
mr_tawan


Joined: 13 Jan 2014
Posts: 161
If I'm not mistaken, I think you could remove the reference to SDL lib file from both of your library, and let the user links against it in the client project.

Give it a try.
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
Thanks for the suggestion. Can you provide more details? I'm not sure what your suggesting.
mr_tawan


Joined: 13 Jan 2014
Posts: 161
I supposed you're using Visual C++. In your physics engine and game engines, you've both of them have Additional Include library contains SDL include path, and also have Additional Dependencies (in the Linker's input page) contains SDL.lib or something like that.

AFAIK the include path needs SDL path (otherwise they won't compile) but the dependencies is not really required at this point. You can however add the SDL.lib in the project that uses both physics engine and game engine as the 3rd dependency library.

As I mentioned I'm not really sure myself as well (as I usually leave it as dynamic library to stay out of problem). Give it a try.
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
I understand what your saying now. That option is not available for projects compiled as a static library in VC++ so that's already the case.
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
I was able to achieve my goal of statically linking SDL2 for a Windows app. I just needed to build the project in VC++ 10 as a static library and add that to my game project.

Had to comment out line #243 (__declspec(selectany) int _fltused = 1Wink because this symbol already exists in another windows library (LIBCMTD.lib).

All is good now.