Why do you need include files to go into MLton and a new main? Isn't it enough to have the ability to link in with foreign libraries and to then call them via _ffi? I.e., wouldn't it be enough to simply have SDL users call some sdlStartup function before they did any stuff? Then there would not be any of these horrible #ifdef's or any SDL any thing in MLton code. Am I missing something?