[SDL] Embed SDL.dll in the .exe
David Olofson
david at olofson.net
Wed Sep 26 01:32:51 PDT 2007
On Wednesday 26 September 2007, Sylvain Beucler wrote:
> Hi,
>
> I'm porting a C game to SDL + some libraries (SDL_mixer, SDL_ttf,
> SDL_gfx).
>
> I'd like to compile a .exe that includes SDL.dll, SDL_mixer.dll,
> etc.,
> so that users who want to use the improved SDL version just have to
> drop-in 1 .exe file, and do not need to install all the .dll.
This sounds very backwards to me... This is exactly why you do NOT
want a statically linked executable! :-)
Also, you do realize that releasing only statically linked executables
of a closed source application violates the licence of LGPL libs
(like SDL), right? You need to provide a dynamically linked version
as well, or linkable object files, or (obviously) the source code, or
otherwise ensure that users can use your software with whatever SDL
version they want.
> I'm using mingw gcc, but no luck so far with -static (gcc want to
> include W32 API functions statically such as _mciSendCommandA at 16 and
> obviously can't find them).
>
>
> Anybody has experience with this? Is that possible?
You can specify more exactly how to link each lib by linking in
multiple stages if you just compile to object files and then use 'ld'
for linking. I think it might work if you first create an object
linked with all the static stuff, and then link that with anything
you still want dynamic, to produce the executable.
If all else fails, simply don't have dynamically linked libs installed
when you link your executable. The linker will have no choice but to
use the static versions. :-)
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
More information about the SDL
mailing list