# SDL\_dll.h?

**URL:** <https://discourse.libsdl.org/t/sdl-dll-h/5443>\
**Category:** SDL Development\
**Created:** [November 15, 2001, 6:46am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443 "2001-11-15T06:46:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Duncan](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@Jeff\_Duncan](https://discourse.libsdl.org/u/Jeff_Duncan)\
**Post date:** [November 15, 2001, 6:46am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/1 "2001-11-15T06:46:06Z")

</div>

Just curious about the lack of this module. Win32 and UNIX have similar DLL  
open/close and (function) symbol retrieval syntax. It would be nice to have  
this abstraction included in an OS abstraction toolkit such as SDL rather  
than coding it for one’s own projects.

I’m not sure how easy this would actually be, given that I know nothing  
about the large number of other OS flavors this beastie runs on, but thought  
I’d ask if this had been previously considered and discarded.

Thanks,  
– Jeff

---

<div class="post-metadata">

**Author:** ![Lloyd\_Dupont](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@Lloyd\_Dupont](https://discourse.libsdl.org/u/Lloyd_Dupont)\
**Post date:** [November 15, 2001, 6:56am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/2 "2001-11-15T06:56:01Z")

</div>

it is plan for SDL 1.3 (i have heard…)  
anyway a quick fix could be:

void \* SDL\_LoadLibrary(char \* name)  
{  
#ifdef WIN32  
return LoadLibrary(name);  
#else  
return dlopen(name, 0);  
#endif  
}

void SDL\_CloseLibrary(void \* handle)  
{  
#ifdef WIN32  
return FreeLibrary(handle);  
#else  
return dlclose(handle);  
#endif  
}

void SDL\_FindSymbol(void \* handle, char \* sym)  
{  
#ifdef WIN32  
return GetProcAddress(handle, sym);  
#else  
return dlsym(handle, sym);  
#endif  
}

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [November 17, 2001, 12:07pm UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/3 "2001-11-17T12:07:01Z")

</div>

> Just curious about the lack of this module. Win32 and UNIX have similar DLL  
> open/close and (function) symbol retrieval syntax. It would be nice to have  
> this abstraction included in an OS abstraction toolkit such as SDL rather  
> than coding it for one’s own projects.

There are actually a whole host of hidden issues with this that I might  
as well expound upon since I’m thinking of it.

As somebody else mentioned, the basic interface is very simple:

1. open library handle
2. retrieve pointer to function
3. call function
4. close library handle

Here are the issues that may bite you, depending on the platform(s)  
you want your code to work on:

1. Calling convention, ABI issues:  
Do the functions in the library you’re linking with use the same  
calling convention as the application code? If not, does the  
application code know what the proper calling convention is?

2. Runtime environment:  
Do the functions in the library use the same runtime as your  
application? If they don’t, your application may load a runtime  
environment that may clash with the one (possibly separately  
loaded) by the shared object. The simplest example of this is  
where the application and the shared object are linked with  
different version of the C library - they may conflict.

3. Namespace collisions and other issues:  
A shared object isn’t usually self contained. Especially when  
writing a driver module, the code will call functions that are  
not wholly contained within the shared object. Even if they are,  
it’s not always defined which symbol is used by your code if the  
same symbol is included in both the shared object and the main  
application, or even another separately loaded shared object.

These are all hidden pitfalls in using general purpose object loading  
code, and they should be considered by anyone using it. It’s not to  
say that you shouldn’t dynamically loaded code, but be very careful  
about the conditions under which you do.

See ya,  
-Sam Lantinga, Software Engineer, Blizzard Entertainment

---

<div class="post-metadata">

**Author:** ![Jeff\_Duncan](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@Jeff\_Duncan](https://discourse.libsdl.org/u/Jeff_Duncan)\
**Post date:** [November 19, 2001, 8:41am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/4 "2001-11-19T08:41:01Z")

</div>

Just wanted to thank you for the post identifying issues in DLL design. I  
now know more about namespace collision issues than I did before -  
particularly the nasty shared symbol resolution issue, which I think I’ve  
seen symptoms of in a previous iteration of my graphics engine. I’ll be  
better equipped to handle this with the new revision…

Thanks!  
– Jeff

---

<div class="post-metadata">

**Author:** ![Jordan\_Wilberding](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/jordan_wilberding/32/120_2.png) [@Jordan\_Wilberding](https://discourse.libsdl.org/u/Jordan_Wilberding)\
**Post date:** [November 19, 2001, 9:57am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/5 "2001-11-19T09:57:01Z")

</div>

Hello,

I am just wondering if it is possible to make more then once screen when  
using SDL? So you can have a main screen and loop, then spawn a smaller  
screen(like a dialog). Is this possible?–  
Jordan Wilberding \<@Jordan\_Wilberding\>  
[Diginux.net](http://Diginux.net) Sys Admin

\<[wod.sourceforge.net](http://wod.sourceforge.net)\>  
\<[aztec.sourceforge.net](http://aztec.sourceforge.net)\>

“Fight war, not wars,  
destroy power, not people”  
-Crass

---

<div class="post-metadata">

**Author:** ![Shane\_Fausett](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@Shane\_Fausett](https://discourse.libsdl.org/u/Shane_Fausett)\
**Post date:** [November 19, 2001, 10:10am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/6 "2001-11-19T10:10:01Z")

</div>

The SDL is an abstraction of a frame buffer … it is not a windowing  
system. But as you have complete control of the frame buffer there is  
nothing stopping you from drawing a dialog box onto it.

Shane  
At 12:04 PM 11/19/2001 -0600, you wrote:\>Hello,

> I am just wondering if it is possible to make more then once screen when  
> using SDL? So you can have a main screen and loop, then spawn a smaller  
> screen(like a dialog). Is this possible?
> 
> –  
> Jordan Wilberding   
> [Diginux.net](http://Diginux.net) Sys Admin
> 
> \<[wod.sourceforge.net](http://wod.sourceforge.net)\>  
> \<[aztec.sourceforge.net](http://aztec.sourceforge.net)\>
> 
> “Fight war, not wars,  
> destroy power, not people”  
> -Crass
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

---

<div class="post-metadata">

**Author:** ![Jakob\_Kosowski](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@Jakob\_Kosowski](https://discourse.libsdl.org/u/Jakob_Kosowski)\
**Post date:** [November 19, 2001, 10:18am UTC](https://discourse.libsdl.org/t/sdl-dll-h/5443/7 "2001-11-19T10:18:00Z")

</div>

No. Calling SDL\_SetVideoMode would destroy the old display and create a new one.  
This is a way to switch from windowed mode to fullscreen (or the other way round),  
to change resolutions, the color depth, and to enable OpenGL or the evil OPENGLBLIT  
at runtime.On Mon, Nov 19, 2001 at 12:04:30PM -0600, Jordan Wilberding wrote:

> Hello,
> 
> I am just wondering if it is possible to make more then once screen when  
> using SDL? So you can have a main screen and loop, then spawn a smaller  
> screen(like a dialog). Is this possible?
