[racket-dev] foreign struct access different in 5.1.3?

From: John Clements (clements at brinckerhoff.org)
Date: Fri Sep 16 18:06:37 EDT 2011

I'm trying to backport working FFI code to 5.1.3, and I'm having trouble referring to elements of a C struct. Specifically, in the presence of this definition

(define-cstruct _rack-audio-closure
  ([sound         _pointer]
   [cur-sample    _ulong]
   [num-samples   _ulong]
   [stop-now      _bool]
   [stop-sema-ptr _pointer]))

using the function (rack-audio-closure-cur-sample) on the result of an FFI call with signature

(_fun _pointer _ulong _pointer -> _rack-audio-closure-pointer)

produces this error:

rack-audio-closure-cur-sample: expected argument of type <struct:rack-audio-closure>; given #<cpointer:rack-audio-closure>

in 5.1.3, but it works just fine in the git head.

Git log suggests to me that you (Kevin) might have changed/fixed this in a810b30b872787a1365c, so here's the question: is there some workaround to access the elements of a C struct in 5.1.3?

Many thanks,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110916/c789e90f/attachment.p7s>

Posted on the dev mailing list.