I'm making a program that receives messages from the iPhone App touchOSC. These messages are packaged into UPD datagrams.
<div><br></div><div>There's an open-source library (liblo) that handles the details of receiving the UDP messages and decoding the OSC protocol.</div><div><br></div><div>I want to make a c library that's callable from lisp. I was thinking of the following three functions, which capture everything I need for this project:</div>
<div><br></div><div>void init_osc(int port, void(*callback)(char* data));</div><div><br></div><div>void osc_done(void);</div><div><br></div><div>init_osc() would be called to initialize liblo. It takes a port number, which is the port that liblo should listen on, and a function pointer. When liblo receives an OSC message, it will call this callback, passing it an ordinary c string representation of the message.</div>
<div><br></div><div>This callback will be made in the context of a thread spawned by liblo during the init_osc() call.</div><div><br></div><div>The other function osc_done() would be called when the program is exiting, to do any cleanup the library needs.</div>
<div><br></div><div><br></div><div>Now to my question: Will this work? Is it possible for this liblo thread to call into my lisp program, passing a string?</div><div><br></div><div>If no, what's a better way to do this?</div>
<div><br></div><div>If yes, what syntax do I use to set up the callback?</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Neil</div><div> </div>