Discussion:
[Larceny-users] difficulty with callback
David Rush
2010-01-26 18:53:43 UTC
Permalink
Hi there,

In working with this foreign function definition:

(define rtaudio-open-stream
(foreign-procedure "RTAWOpenStream"
'(void*
; DAC object
(maybe void*)
; output params
(maybe void*)
; input params
int
; audio format
int
; sample rate
boxed
; unsigned int* bufferFrames
(-> (void* void* unsigned float int void*)
void) ; callback function needs to be stdcall
(maybe void*)
; user data context
(maybe void*)
; stream options
)
'int
'cdecl))

I have encountered what appears t me to be an important question: How
do I define the callback function's calling convention? I was just
crawling through the underlying library code and it appears that it is
expecting a stdcall callback under the cdecl API.

help?

david
--
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
Felix Klock
2010-01-26 19:07:20 UTC
Permalink
David-

An error invocation in lib/Ffi/ffi-i386.sch says that the Callback abi has not been implemented for stdcall.

It would be nice to fix, but I do not know when I will be able to spend time on the problem.

(There are two separate implementation problems here: adding stdcall callback support in the low-level code, and extending the high-level surface syntax for callbacks using stdcall. I think neither has been attacked.)

In the meantime, I have filed this as Ticket #660.

https://trac.ccs.neu.edu/trac/larceny/ticket/660

-Felix
Post by David Rush
Hi there,
(define rtaudio-open-stream
(foreign-procedure "RTAWOpenStream"
'(void*
; DAC object
(maybe void*)
; output params
(maybe void*)
; input params
int
; audio format
int
; sample rate
boxed
; unsigned int* bufferFrames
(-> (void* void* unsigned float int void*)
void) ; callback function needs to be stdcall
(maybe void*)
; user data context
(maybe void*)
; stream options
)
'int
'cdecl))
I have encountered what appears t me to be an important question: How
do I define the callback function's calling convention? I was just
crawling through the underlying library code and it appears that it is
expecting a stdcall callback under the cdecl API.
help?
david
--
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
_______________________________________________
Larceny-users mailing list
https://lists.ccs.neu.edu/bin/listinfo/larceny-users
David Rush
2010-01-26 19:11:03 UTC
Permalink
Post by Felix Klock
(There are two separate implementation problems here: adding stdcall callback support in the low-level code,
and extending the high-level surface syntax for callbacks using stdcall.  I think neither has been attacked.)
That is just about exactly what I expected :) Or rather, the
high-level syntax problem doesn't have an obviously "nice" solution,
so I do sympathize.
Post by Felix Klock
In the meantime, I have filed this as Ticket #660.
Great, thank you.

david rush
--
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
Loading...