"Simple" Directmedia Layer

Hello Everyone,

First off, kind of funny thing. I’m guessing Sam’s middle inital is D… so
with SDL, he worked out a name to work with his initals. Am I right?

Anyway, on to the real question. While not trying to start a Micro VS
Monolithic flame. I’m curious as to if with SDL 1.3, there are plans to make it
more modular, making some of the “non-essential” functions in their own library?
(eg. SDL_Joystick, SDL_CDRom etc.) Probably not a big deal. Some of the
projects I work on, the executables are under 50k, but then even a non-debug SDL
library, I’m looking at ~450k. Some of the programs I do are simply for image
manipulation. When I do a custom build, I can get SDL down close to 150k.

Then again, size isn’t that important.

My other question is, is there any way to change a library, (say SDL_image) so
that it can run without it, it just cannot load PNGs/JPGs/ETCs. So, some way to
check during run time if it is there, if not, then the IMG_Load is a function
pointer that will point at SDL_LoadBMP. And if something other than a BMP is
attempted to be loaded, it fails with an error?

Is what I’m talking about possible? If I’m the only one asking for it, then
forget it, it’s really not that big of a deal.

Hello !

First off, kind of funny thing. I’m guessing Sam’s middle inital is D… so
with SDL, he worked out a name to work with his initals. Am I right?

No. It is O :slight_smile: Sam “Oscar” Lantinga :slight_smile:

CU

Hello !

My other question is, is there any way to change a library, (say SDL_image) so
that it can run without it, it just cannot load PNGs/JPGs/ETCs. So, some way to
check during run time if it is there, if not, then the IMG_Load is a function
pointer that will point at SDL_LoadBMP. And if something other than a BMP is
attempted to be loaded, it fails with an error?

Is what I’m talking about possible? If I’m the only one asking for it, then
forget it, it’s really not that big of a deal.

With a few configure options you can build a
custom SDL_image with PNGs, JPGs and others
disabled. The same goes with SDL.

CU

Sam! Is that true? If that happened to me, I’d be inclined to sue my mother,
but I bet the lawyers would say I’m SOL :slight_smile:

(Sorry, couldn’t resist.)

JeffOn Tue October 28 2008 14:49, Torsten Giebl wrote:

Hello !

First off, kind of funny thing. I’m guessing Sam’s middle inital is D…
so with SDL, he worked out a name to work with his initals. Am I right?

No. It is O :slight_smile: Sam “Oscar” Lantinga :slight_smile:

Hello !

First off, kind of funny thing. I’m guessing Sam’s middle inital is D…
so with SDL, he worked out a name to work with his initals. Am I right?

No. It is O :slight_smile: Sam “Oscar” Lantinga :slight_smile:

Sam! Is that true? If that happened to me, I’d be inclined to sue my mother,
but I bet the lawyers would say I’m SOL :slight_smile:

(Sorry, couldn’t resist.)

Jeff

And I was just sitting here thinking being named SOL explained his
sunny personality. :slight_smile:

Bob PendletonOn Tue, Oct 28, 2008 at 6:13 PM, Jeff <j_post at pacbell.net> wrote:

On Tue October 28 2008 14:49, Torsten Giebl wrote:


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

±-------------------------------------+

First off, kind of funny thing. I’m guessing Sam’s middle inital is D… so
with SDL, he worked out a name to work with his initals. Am I right?

I thought that too, at first, but the initial is actually ‘O’.

I hope I didn’t give away a deep secret there. :slight_smile:

Anyway, on to the real question. While not trying to start a Micro VS
Monolithic flame. I’m curious as to if with SDL 1.3, there are plans to make it
more modular, making some of the “non-essential” functions in their own library?
(eg. SDL_Joystick, SDL_CDRom etc.) Probably not a big deal. Some of the
projects I work on, the executables are under 50k, but then even a non-debug SDL
library, I’m looking at ~450k. Some of the programs I do are simply for image
manipulation. When I do a custom build, I can get SDL down close to 150k.

We talked about this many years ago, and decided not to split it up;
people that need embedded builds can trim out drivers and whole
subsystems to get a smaller library.

My other question is, is there any way to change a library, (say SDL_image) so
that it can run without it, it just cannot load PNGs/JPGs/ETCs. So, some way to
check during run time if it is there, if not, then the IMG_Load is a function
pointer that will point at SDL_LoadBMP. And if something other than a BMP is
attempted to be loaded, it fails with an error?

You can dynamically load libraries at runtime. Here’s some untested code.

typedef SDL_Surface *(*LoadImg)(const char *file);

// SDL_LoadBMP() is a macro, not a real function. :confused:
static SDL_Surface *LoadBmp(const char *fname)
{
return SDL_LoadBMP(fname);
}

// near program startup…
LoadImg pLoadImg = NULL;
void *lib = SDL_LoadObject(“libSDL_image.so”);
if (lib != NULL)
pLoadImg = (LoadImg) SDL_LoadFunction(lib, “IMG_Load”);

if (pLoadImg == NULL)
pLoadImg = LoadBmp;

// Do your program here. When you need to load an image…
SDL_Surface *myimg = pLoadImg(myimg_filename);
// will be NULL if the image wasn’t a .bmp and SDL_image wasn’t there.

// near end of program…
if (lib != NULL)
SDL_UnloadObject(lib);

–ryan.