[SDL] Dynamically loading SDL dlls

Ulrich Eckhardt doomster at knuut.de
Mon Oct 29 23:24:49 PDT 2007


On Tuesday 30 October 2007 05:23:23 Jeremy wrote:
> Is there an alternative to SDL_SetLibraryPath ?

Not 100% sure, as I couldn't find any documentation on what it should do.

> I'd like to load the SDL libraries from a folder of my choice, one that
> isn't the executables folder, and isn't in the path. Is there no support
> for doing this? Some documentation implies the dll shouldn't be
> loaded/required until you call SDL_Init, but without the dll in the path,
> windows folder, app folder, etc. My dll that uses SDL fails to load, which
> indicates it does indeed need the sdl library well before SDL_Init.
> SDL_SetLibraryPath appears to be what I would use in this case but it seems
> to have been removed some time ago.

You need to treat SDL as a plugin then. IOW, for win32, take a look at 
LoadLibrary/GetProcAddress while for POSIX look at dlopen/dlsym.

Other than that, how about replacing the application with a simple script that 
sets up the environment and then launches the executable?


Uli


More information about the SDL mailing list