[SDL] Dynamically loading SDL dlls

Jeremy jswigart at gmail.com
Thu Nov 1 16:50:22 PDT 2007


Yea I tried for a while last night to do the converting of SDL to a true
dynamic library but it's a nightmare so I gave up. I don't need SDL that
badly to jump through those sort of hoops with a middle man dll. I've begun
converting my SDL usage to SFML, which I now prefer over SDL for my
situation, mainly due to static linkage and being in C++, and its simplicity
got me up and running very quickly.

Thanks for the input.

Jeremy

On 11/1/07, Andre de Leiradella <leiradella at bigfoot.com> wrote:
>
> > I don't want to add bloat to their game executable folder, or add
> stuff to their system folders, or PATH, etc.
>
> SetEnvironmentVariable only changes the current process' environment.
> But you'll have to test if this environment is the one used by
> LoadLibrary. I guess it is.
>
> Since your application is already a DLL, you can just put it together
> with all other DLLs in a separate folder. Now write another DLL, a small
> one that will change the PATH variable and load your "main" DLL using
> LoadLibrary. The other DLLs will be automatically loaded when the "main"
> DLL is loaded.
>
> This small DLL will have to have proxy functions that will just call
> functions of your "main" DLL, whose pointers you'll obtain using
> GetProcAddress. I'm assuming that the number of functions of the bot API
> is way less than the number of SDL functions you use in your code.
>
> I already tried to LoadLibrary SDL.dll and a few others. I found myself
> with loads of GetProcAddress and fighting with macro definitions, and
> with the impression that my code would break with the very next SDL
> release.
>
> Cheers,
>
> Andre
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20071101/a90da232/attachment.html 


More information about the SDL mailing list