I'm using the Max sdk for a small, networked, multi-threaded application. All these factors make it a hellish nightmare as it is, but the benefits outweigh the heartache.
I'm attempting to create an object within a thread, and upon reaching the code:
object_obex_lookup( &m_ob, gensym( "#P" ), &patcher );
t_object* gain = newobject_sprintf( patcher, "@maxclass gain~ @patching_rect 100. 100. 20. 100."); /* This is the line that crashes */
Within a thread, the application crashes.
When I attempt to put this code within the perform method that is common with MSP objects, it also crashes.
However, if I put the above code within one of my methods that is communicated with Max via messages (e.g., bang), the gain~ object appears.
There's a few routes I could take with this, but I'd like to keep the multithreaded aspect alive and running.
I've also attempted to use critical_enter and critical_exit to no avail.
So, can Max objects not be created outside of a main thread or something?
I'm also using the C++ wrapper API provided on googlecode for this as well.