If SDL2 offers a static version of the library you can build your project by embedding SDL2 into your library, so your end-user only needs to link against your library.
You can see this discussion here: http://forums.libsdl.org/viewtopic.php?p=39289
http://translate.google.com/translate?js=n&sl=auto&tl=pt&u=http://forums.libsdl.org/viewtopic.php? p=39289
The static connection works, but I recommend you use HAVE_LIBC and the
Visual Runtime Library C++ in this case. SDL implementations for
Visual C++ specific functions can cause problems otherwise.
If attachment is completed, it contains a batch file (gmail
didn’t let me send as a .bat. Just rename it. ) And two C files that
may be similar to your situation. Download the SDL source 2 and
extracts it next to these files. I also included the
Sdl_config_windows. h for MSVC 2010 if you create with it. I think the
HAVE_X sets for HAVE_LIBC are adapted for 2012.
If you run build.bat in the build environment, it should render a DLL
with SDL 2 statically connected and an executable importing some
works from it. I have some specific x86 options to delete
warnings, but change them to x64 to create a 64-bit compilation.
Work perfectly.
Also, it can be useful if we can see how you fit
together. cl.exe and link.exe invocations and all that.
And of course this has licensing implications, but it seems that for version 2 this has been modified as presented here: https://wiki.libsdl.org/Installation#Static_linking
http://translate.google.com/translate?js=n&sl=auto&tl=pt&u=https://wiki.libsdl.org/Installation#Static_linking
Static connection
SDL 2.0, unlike 1.2, uses the zlib license, meaning you can create a static library directly connected to your program or simply compile the SDL C code directly as part of your project. You’re fully authorized to do that. However, we encourage you not to do so for various technical and moral reasons (see Docs / README-dynapi.Md ) and will not cover the details of how in this document. You may not link SDL 1.2 in most cases due to LGPL licensing, but you should really stop using SDL 1.2 anyway.
Even Windows? That I have to impression that on Linux it would be possible to just add the
.a
of the other library within yours. Or even unpack the static library and repack the other object files with those in your library– Jefferson Quesado
I am using Linux, but I would like a solution that works for both systems. I have tried adding . that of the other library in mine but it didn’t work, when compiling the client code gives linkediting error. I was also reading about the second solution that you proposed, but I learned that it is very risky, because if you have two identical symbols (functions or variables) in the two files . a, one of them is lost at the time of repackaging (but I have not tested the hypothesis).
– user72726