SDL initialization

It there a way to dynamically check if there is SDL dynamic library or not?
Now when I link with SDL it forces existance of SDL.dll (in case of Windows) or
application does not start at all.

Its been some years since I’ve done DLL depency on windows without
linking against them, but I believe you can OpenDLL or something
similar from within code. This keeps it out of the exe header as a
dependency, but lets the program attempt to run without it (and if you
don’t require it then you can use fail checks to disable usage etc).
I… can’t recall the author of the book I worked from… was a
win3.1/win32 reference of some kind… was the defacto old win16/win32
reference as well. Really wish I could recall the guy’s name.

-WillOn Tue, Jul 15, 2008 at 9:21 AM, Grzegorz Tanski wrote:

It there a way to dynamically check if there is SDL dynamic library or not?
Now when I link with SDL it forces existance of SDL.dll (in case of Windows) or
application does not start at all.

I believe LoadLibrary() may be what you’re looking for in the win32 world.

http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx

Note: article also mentions the subsequent calls you’ll need to make
to access functions and resources within the supplied library.

-WillOn Tue, Jul 15, 2008 at 3:44 PM, Will Langford <@William_Langford> wrote:

On Tue, Jul 15, 2008 at 9:21 AM, Grzegorz Tanski wrote:

It there a way to dynamically check if there is SDL dynamic library or not?
Now when I link with SDL it forces existance of SDL.dll (in case of Windows) or
application does not start at all.

Will Langford <unfies gmail.com> writes:

It there a way to dynamically check if
there is SDL dynamic library or not?

Now when I link with SDL it forces
existance of SDL.dll (in case of Windows) or

application does not start at all.

I believe LoadLibrary() may be what you’re looking for in the win32 world.

http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx

Note: article also mentions the subsequent calls you’ll need to make
to access functions and resources within the supplied library.

-Will

Thanks for reply.

LoadLibrary() is a kind of solution, but
it would be best when SDL_init() simply
fails when “SDL.dll” is missing. LoadLibrary()
forces me to use GetProcAdress() for every
function I want to use and it not portable
(when the whole thing to use SDL is portability).
I wonder how it works on other platforms.
Must check on Mac and Linux.

How could SDL_Init return an error - when SDL_Init is inside SDL.dll =)

There is no easy solution. If you let windows load SDL.dll for you
then it will refuse to load your application unless it finds it. The
only other way (AFAIK) is using LoadLibrary() and friends, with the
downsides that you mentioned.On Tue, Jul 15, 2008 at 10:17 PM, Grzegorz Tanski wrote:

Will Langford <unfies gmail.com> writes:
LoadLibrary() is a kind of solution, but
it would be best when SDL_init() simply
fails when “SDL.dll” is missing.

LoadLibrary() is a kind of solution, but
it would be best when SDL_init() simply
fails when “SDL.dll” is missing. LoadLibrary()
forces me to use GetProcAdress() for every
function I want to use and it not portable
(when the whole thing to use SDL is portability).
I wonder how it works on other platforms.
Must check on Mac and Linux.

What would you do in the case where the library is not available?On Tue, Jul 15, 2008 at 5:17 PM, Grzegorz Tanski wrote:


http://pphaneuf.livejournal.com/

What would you do in the case where the library is not available?

If you support multiple backends for audio, video, system control, etc
– then maybe you’d use a different mechanism.

IE: supporting

OpenGL, DirectX, GDI, DirectX, or SDL for video.

waveout, dsound, artsd, etc, sdl for audio

etc etc etc

Kind of going with a utilitarian approach to a generic app. While I
don’t agree with the approach, it’s definitely feasible.

-Will

What would you do in the case where the library is not available?

If you support multiple backends for audio, video, system control, etc
– then maybe you’d use a different mechanism.

My idea there was that not having a portable way to do this is fine,
in a way, since you’ll almost certainly have to do something
non-portable as a fallback (although I’d probably have SDL as a
fallback in the first place, myself).

Me, I just ship the appropriate DLLs in the installer, and link
against SDL normally.On Tue, Jul 15, 2008 at 6:21 PM, Will Langford wrote:


http://pphaneuf.livejournal.com/

Pierre,

Do you mean that you incorporate the SDL dynamic lib with the application package, and then
copy it to a particular location if no other lib is found ? (I suppose most applications with installers
do it that way isn’t it ?)

Then, loading the library is necessary only when the lib is not installed in a standard location, isn’t it ?

----- Message d’origine ----De : Pierre Phaneuf
? : A list for developers using the SDL library. (includes SDL-announce)
Envoy? le : Mercredi, 16 Juillet 2008, 0h30mn 42s
Objet : Re: [SDL] SDL initialization

On Tue, Jul 15, 2008 at 6:21 PM, Will Langford wrote:

What would you do in the case where the library is not available?

If you support multiple backends for audio, video, system control, etc
– then maybe you’d use a different mechanism.

My idea there was that not having a portable way to do this is fine,
in a way, since you’ll almost certainly have to do something
non-portable as a fallback (although I’d probably have SDL as a
fallback in the first place, myself).

Me, I just ship the appropriate DLLs in the installer, and link
against SDL normally.


http://pphaneuf.livejournal.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  _____________________________________________________________________________ 

Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

Do you mean that you incorporate the SDL dynamic lib with the application
package, and then
copy it to a particular location if no other lib is found ? (I suppose most
applications with installers
do it that way isn’t it ?)

Then, loading the library is necessary only when the lib is not installed in
a standard location, isn’t it ?

On Linux, I do not package SDL, but use the package management.
Nowadays, people use things like Synaptics or “apt-get install
mygame”, and everything is figured out for them, it gets SDL
automatically.

On Windows and Mac OS X, I put the SDL library in the application
installer, and never use the “system” library, because it’s just
about never there, or it’s in some non-standard location. On both
these platforms, there’s a particular place where you can put
libraries alongside the application and they will be found (on
Windows, the directory where the EXE is located is at the front of the
DLL path, and on Mac OS X, you can put internal frameworks inside an
application bundle).On Wed, Jul 16, 2008 at 7:12 AM, julien CLEMENT wrote:


http://pphaneuf.livejournal.com/

Brian <brian.ripoff gmail.com> writes:

How could SDL_Init return an error - when SDL_Init is inside SDL.dll =)

:slight_smile: , but to be serious, simply SDL_Init should be placed in SDL.lib instead of
SDL.dll and it should try to open .dll and if its ok call SDL_init from .dll or
return error code when there is no .dll.

What would you do in the case where the library is not available?

My app runs fine fired from console, but its nice when it have graphical preview
window. So scenario is simple. Try to open SDL, if ok show user graphics,
otherwise work in text mode.

can anyone confirm or deny if 1.3 has dual monitor support on both
Windows AND Mac OS X ?

i have a project that i’m about to rewrite (partially) from DirectX to
SDL, but I can only do it if I have multimon support…

feedback GREATLY appreciated since I have to convince my boss to go
with SDL !

you could at least do opengl, anything but directx :SOn Wed, 16 Jul 2008, jeroen clarysse wrote:

can anyone confirm or deny if 1.3 has dual monitor support on both Windows
AND Mac OS X ?

i have a project that i’m about to rewrite (partially) from DirectX to SDL,
but I can only do it if I have multimon support…

feedback GREATLY appreciated since I have to convince my boss to go with SDL
!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

with directX, I have sufficient code to work multimon. If I can’t get
multimon with SDL on mac & windows, there is little or no use in SDL,
since I only need 2D blitting and some sound

but I like SDL so much (used it for my previous project that did not
need multimon) that i REALLY want to use it again

so all will depend on wether SDL 1.3 supports multimon or not on mac
AND windows> you could at least do opengl, anything but directx :S

On Wed, 16 Jul 2008, jeroen clarysse wrote:

can anyone confirm or deny if 1.3 has dual monitor support on both
Windows AND Mac OS X ?

i have a project that i’m about to rewrite (partially) from DirectX
to SDL, but I can only do it if I have multimon support…

feedback GREATLY appreciated since I have to convince my boss to go
with SDL !


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org