[A5] Mac magic main initialization
DanielDLee

Hello,
I was trying to get Allegro 5 working on a Mac
with the allua Lua bindings. The allua dynamic library
compiles fine, but when trying to call al_create_display()
via the Lua allegro5.display.create() binding, I get
the following exception:

Initialized allegro
2012-12-28 23:08:46.916 lua[60096:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 259'

I'm assuming this is because the lua script does not
go through the proper Allegro magic main initialization.
Does anyone know if there is a way to make explicit function
calls to initialize the Allegro NSApplication properly
on Mac OS X?
Thanks!

Elias

Yes, al_run_main. It will never return, but you pass it a C function which we be called from another thread. Call al_init and so on from that other function then as if it was your main() function.

Thread #611721. Printed from Allegro.cc