Vuo  0.4.8
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CompileAndRunInCurrentProcess.cc

Example: Compile a composition and run it in the current process.

#include <dispatch/dispatch.h>
#include <Vuo/Vuo.h>
int main(void)
{
// Compile, link, and run the composition in the current process
VuoRunner * runner = VuoCompiler::newCurrentProcessRunnerFromCompositionFile(VUO_COMPOSITION_PATH "/Count.vuo");
runner->start();
// On a separate thread, wait 5 seconds, then stop the composition
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
sleep(5);
runner->stop();
});
// Perform the work the composition needs on the main thread, and wait for the compostion to stop
runner->runOnMainThread();
delete runner;
return 0;
}