Csound Csound-dev Csound-tekno Search About

[Cs-dev] Callback functions...

Date2006-01-18 19:32
FromRory Walsh
Subject[Cs-dev] Callback functions...
Hi people, I am trying to upgrade a project that was using the 
Csound4.23API to Csound5 but I am having difficulty with the callback 
functions, namely csoundSetInputValueCallback() and 
csoundSetMessageCallback(). I had successfully used the functions before 
but this time I've had no joy, it keeps returning an access violation in 
module Csound32.dll. If I comment out the body of the callback function 
called by either of these functions there is still an access error 
message. The only way to get rid of the constant access error pop-up 
window is to comment out the actual call to the CsoundAPI functions 
which is strange. csoundSetInputValueCallback() is not such a biggy as 
after consulting Victor he suggested I'd be better off using 
csoundGetChannelPtr() which works fine. The real problem though is that 
I can't access the Csound output messages? Are they're any alternative 
methods for retrieving this data that don't use callback function? If 
not has anyone encountered this problem before? By the way, I'm working 
with Borland C++ Builder 6. One last thing, in the previous project I 
didn't use a dll, I rebuilt the CsoundAPI in Borland and linked to the 
static lib, I rather not have to go to all that trouble this time. This 
is my first post to this list so excuse me if I have left out anything 
obvious info.

regards,
Rory.



-------------------------------------------------------
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

Date2006-01-19 13:16
FromVictor Lazzarini
SubjectRe: [Cs-dev] Callback functions...
This suggests to me that either there is a bug in Csound32.dll or that gcc
is not generating a DLL that can be open and used by binaries generated
by other compilers. This limits the usefulness of the Csound DLL.

That is, of course, if you have not had your headers mixed up (which I presume
you don't).

Victor

At 19:32 18/01/2006, you wrote:
>Hi people, I am trying to upgrade a project that was using the 
>Csound4.23API to Csound5 but I am having difficulty with the callback 
>functions, namely csoundSetInputValueCallback() and 
>csoundSetMessageCallback(). I had successfully used the functions before 
>but this time I've had no joy, it keeps returning an access violation in 
>module Csound32.dll. If I comment out the body of the callback function 
>called by either of these functions there is still an access error 
>message. The only way to get rid of the constant access error pop-up 
>window is to comment out the actual call to the CsoundAPI functions which 
>is strange. csoundSetInputValueCallback() is not such a biggy as after 
>consulting Victor he suggested I'd be better off using 
>csoundGetChannelPtr() which works fine. The real problem though is that I 
>can't access the Csound output messages? Are they're any alternative 
>methods for retrieving this data that don't use callback function? If not 
>has anyone encountered this problem before? By the way, I'm working with 
>Borland C++ Builder 6. One last thing, in the previous project I didn't 
>use a dll, I rebuilt the CsoundAPI in Borland and linked to the static 
>lib, I rather not have to go to all that trouble this time. This is my 
>first post to this list so excuse me if I have left out anything obvious info.
>
>regards,
>Rory.
>
>
>
>-------------------------------------------------------
>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
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
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

Date2006-01-19 13:49
FromIstvan Varga
SubjectRe: [Cs-dev] Callback functions...
AttachmentsNone  

Date2006-01-19 17:51
FromRory Walsh
SubjectRe: [Cs-dev] Callback functions...
I wasn't using extern "C", I'll try it again, cheers,
Rory.

Istvan Varga wrote:
> Are the callback functions declared correctly (see examples below),
> and do they use the correct calling convention (i.e. __cdecl, and
> probably also extern "C" if used from C++) ?
> 
> void csoundMessageCallback(CSOUND *, int attr,
>                            const char *format, va_list valist);
> 
> void inputValueCalback(CSOUND *, const char *channelName, MYFLT *value);
> 
> void outputValueCalback(CSOUND *, const char *channelName, MYFLT value);
> 
> On Thursday 19 January 2006 14:16, Victor Lazzarini wrote:
> 
> 
>>This suggests to me that either there is a bug in Csound32.dll or that gcc
>>is not generating a DLL that can be open and used by binaries generated
>>by other compilers. This limits the usefulness of the Csound DLL.
>>
>>That is, of course, if you have not had your headers mixed up (which I presume
>>you don't).
>>
>>Victor
>>
>>At 19:32 18/01/2006, you wrote:
>>
>>>Hi people, I am trying to upgrade a project that was using the 
>>>Csound4.23API to Csound5 but I am having difficulty with the callback 
>>>functions, namely csoundSetInputValueCallback() and 
>>>csoundSetMessageCallback(). I had successfully used the functions before 
>>>but this time I've had no joy, it keeps returning an access violation in 
>>>module Csound32.dll. If I comment out the body of the callback function 
>>>called by either of these functions there is still an access error 
>>>message. The only way to get rid of the constant access error pop-up 
>>>window is to comment out the actual call to the CsoundAPI functions which 
>>>is strange. csoundSetInputValueCallback() is not such a biggy as after 
>>>consulting Victor he suggested I'd be better off using 
>>>csoundGetChannelPtr() which works fine. The real problem though is that I 
>>>can't access the Csound output messages? Are they're any alternative 
>>>methods for retrieving this data that don't use callback function? If not 
>>>has anyone encountered this problem before? By the way, I'm working with 
>>>Borland C++ Builder 6. One last thing, in the previous project I didn't 
>>>use a dll, I rebuilt the CsoundAPI in Borland and linked to the static 
>>>lib, I rather not have to go to all that trouble this time. This is my 
>>>first post to this list so excuse me if I have left out anything obvious info.
>>>
>>>regards,
>>>Rory.
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>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
>>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>Victor Lazzarini
>>Music Technology Laboratory
>>Music Department
>>National University of Ireland, Maynooth 
>>
>>
>>
>>-------------------------------------------------------
>>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
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
> 
> 
> 
> -------------------------------------------------------
> 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
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 



-------------------------------------------------------
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

Date2006-01-19 19:19
FromIstvan Varga
SubjectRe: [Cs-dev] Callback functions...
AttachmentsNone  

Date2006-01-19 19:53
FromRory Walsh
SubjectRe: [Cs-dev] Callback functions...
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.

Rory.


Istvan Varga wrote:
> On Thursday 19 January 2006 18:51, Rory Walsh wrote:
> 
> 
>>I wasn't using extern "C", I'll try it again, cheers,
> 
> 
> Are you also sure that the callback is not __fastcall for
> some reason ? If it is, then it is indeed expected to crash;
> it should be __cdecl.
> 
> 
> -------------------------------------------------------
> 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
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 



-------------------------------------------------------
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

Date2006-01-19 21:14
FromIstvan Varga
SubjectRe: [Cs-dev] Callback functions...
AttachmentsNone