SDL_main within a module

I have a problem.

Some architectures -particularily OS X- supported by SDL
(www.libsdl.org) require the SDL_main function to actually overwrite
main, being “in between” system, and the application main function.
Normally, this makes sense and is easily implementable (almost
transparent) but…

I am moving LuaX, and its SDL module to work with stock unaltered
Lua 5.1 core. Which, of course, won’t allow SDL_main to run above
itself.

What shall I do? Any ideas and discussion is welcome. Does someone
know, how other SDL bindings (Ruby, Python…) have overcome this?
Have they?

-asko

(this message has been separately mailed on both Lua and SDL mailing
lists)