Adding specific interface code to SDL?

I would like to test the waters (i.e. don’t freak out - this is just a
question) with the SDL developers concerning adding code to the MS Windows
branch of the SDL source tree to handle a specific implementation of Lisp,
Corman Common Lisp.

Corman Common Lisp requires that each thread created by SDL be “blessed” for
the purposes of garbage collection. Lisp code can only be executed by
threads which are known by the lisp system. Any Lisp code running on a
thread not known to the collector is usually fatal to that thread.

This only impacts callbacks that have been called on a new thread and are
therefore unknown to the Lisp environment: i.e. SDL_CreateThread and

The SetFilter callback, and all other API calls work just fine.

The code that needs to be added to SDL is in the DLL_THREAD_ATTACH and
DLL_THREAD_DETACH case statements in the DllMain function. Specifically:

typedef void (*FuncPtr)();

HMODULE module = LoadLibrary(“CormanLispServer.dll”);
char* funcName;
FuncPtr func;

funcName = “BlessThread”;
func = (FuncPtr)GetProcAddress(module, funcName);
funcName = “UnblessThread”;
func = (FuncPtr)GetProcAddress(module, funcName);

Obviously the Corman Lisp .dll would have to be loaded ahead of time. I’m
not exactly sure where the LoadLibrary(“CormanLispServer.dll”) call should
go. I currently have it in DllMain, but this means that Windows attempts to
load the .dll each time DllMain is entered.

This functionality would only be required under Windows when the user
specifically wants to interface to Corman Lisp.

And that is it. Please let me know your thoughts.