On Thursday 19 January 2006 20:53, Rory Walsh wrote: > I'm new to all this calling stuff. Is the reason it causes an access > violation error because as __fastcall it tries to write to the CPU > register? Sounds lie a plausible reason for my error. I tried the following: > > extern "C" { > extern void __cdecl csoundMessageCallback(CSOUND *csound,int attr, const > char *format, va_list valist); > } > > Is that the correct way to use __cdecl? I still get the same error. __cdecl means that the caller is responsible for popping arguments from the stack, while in the case of __fastcall (also known as __stdcall or 'pascal' calling convention) it is the called function that pops the arguments. However, 'cdecl' should be the default, unless changed by some special compiler option; it was already found out that your problem is caused by trying to set the message callback before the Csound instance is actually created (in another thread). So, you should probably just move the setting of the callback to the Csound thread. Note that accessing the same CSOUND* instance from multiple threads may be unsafe without synchronization. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net