SDL in a dll?

guess I’ll start with the purpose, I am making an emulator and I want devices to
be seperate from the main executable, so I’m making the devices as elf or
dll(depending on what OS)

basically I’m attempting to call SDL_Quit() inside of an SDL created thread, and
it always will freeze up
my thread is:
int CheckMessages(void *dat){ //this is a generic thread that checks for
messages and handles them
volatile SDL_Event event;
printf("##"); //it gets here
while(1){
SDL_PollEvent(&event);
switch(event.type){
case SDL_QUIT:
SDL_Quit(); //it never finishes/calls this
return(0);
}
}
}

really though it is from
void dll_start(){
//after init of sdl and making a window
messaging=SDL_CreateThread(CheckMessages,0);
return 0;
}

and then the dll returns to the emulator and when I press the X the thread is
suppose to get the message and then quit SDL(but not end my emulator)

Jordan <hackr9483 gmail.com> writes:

and then the dll returns to the emulator and when I press the X the thread is
suppose to get the message and then quit SDL(but not end my emulator)

IIRC you can’t call a DLL function from another DLL in Windows. You may have to
statically link SDL to your custom DLL or else make a callback from your program
executable that will call SDL_quit.

Samuel Crow wrote:

Jordan <hackr9483 gmail.com> writes:

and then the dll returns to the emulator and when I press the X the thread is
suppose to get the message and then quit SDL(but not end my emulator)

IIRC you can’t call a DLL function from another DLL in Windows. You may have to
statically link SDL to your custom DLL or else make a callback from your program
executable that will call SDL_quit.

I’m calling a DLL from a DLL in Windows. I had to wrap the SDL_ttf
render* functions to get around passing SDL_Color by value. My glue DLL
calls into the SDL_ttf DLL. Works just fine.

Here is the link:

http://svn.sourceforge.net/viewvc/lispbuilder/trunk/lispbuilder-sdl-ttf/glue/

  • Luke

Hello !

IIRC you can’t call a DLL function from another DLL in Windows. You may have to
statically link SDL to your custom DLL or else make a callback from your program
executable that will call SDL_quit.

For me this works without problems.

I wrote an easy to use MOD player dll
for a friend using SDL and SDL mixer.

But as i read in the SDL sources
it is important for example to also
free the memory you allocated in the DLL space
too.

That means when you have a Load_MOD function,
you need also to have a Free_MOD function.

Maybe this resource thing is also true for
other things.

CU