Re: [AD] Magic main in Windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]



The real main() under OSX is actually even executed in a secondary thread... The main thread is special as you can fetch system events from inside it only. So the END_OF_MAIN macro under OSX creates a Cocoa application and executes the user main in a newly spawned thread, then keeps on analizying system events until program ends. Originally I made Allegro to have the main() symbol defined inside the lib itself; later I adopted the SDL way and used a separated static lib: liballeg-main.a. The code of this module is held in src/macosx/main.m, for anyone interested (you could see why I think it's not possible to remove the END_OF_MAIN from the OSX port)

It's not clear to me why this necessitates END_OF_MAIN. What is to prevent all this functionality from being done by a normal function that the user calls? The function could create a Cocoa application, start a new thread to analyze system events, and then return back to the user.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/