<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 7, 2014 at 1:56 PM, Alex Queiroz <span dir="ltr"><<a href="mailto:asandroq@gmail.com" target="_blank">asandroq@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hallo,<br>
<div><br>
On Thu, Aug 7, 2014 at 1:46 PM, Álvaro Castro-Castilla<br>
<<a href="mailto:alvaro.castro.castilla@gmail.com" target="_blank">alvaro.castro.castilla@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Specially in the mobile world, there are many platforms that force the developer to think and code its applications around events. Sometimes this is done with virtual functions or interface implementation, overriding methods, or plain C-style callbacks.<br>



><br>
> The problem is, in any of these cases, generally the main loop is controlled by the application. Since Gambit runs within the ___setup(params) function, and then quits (expecting ___cleanup() to be called), there is no way to easily adapt to this architecture except for running in a separate thread and communicating through messages or shared data.<br>



><br>
> Is there a better way to do this?<br>
><br>
<br>
</div>Why can't you package your program as a C library that has an API for<br>
the events?<br>
<br></blockquote><div><br><div><div>That works for implementing the events, but where is the 
Gambit ___setup function running? You can't return from this function 
without breaking Gambit's system.<br><br></div>If there is just one 
thread, how can you run Gambit, then leave the ___setup function and let
 the system call whatever event it requires?<br></div>For instance, in 
SDL2, you are required to define a draw/update callback in iOS and then 
leave the main. If you don't return from Gambit's ___setup() in main, 
the draw/update callback is never run.<br><br></div></div></div></div>