[plt-scheme] ffi circular dependency

From: Tom Schouten (tom at zwizwa.be)
Date: Sun May 17 16:37:49 EDT 2009

On Fri, May 15, 2009 at 11:38:57PM +0200, gabor papp wrote:
> Hi,
> I'm tring to wrap a C structure and a function pointer which have
> circular dependency:

I'm wondering the same thing, but I've seen tricks like this used:

(define _usb-bus-pointer-dummy _pointer)

(define-cstruct _usb-device
  ([next         _usb-device-pointer/null]
   [prev         _usb-device-pointer/null]
   [bus          _usb-bus-pointer-dummy]))

(define-cstruct _usb-bus
  ([next         _usb-bus-pointer/null]
   [prev         _usb-bus-pointer/null]  ...))

(set! _usb-bus-pointer-dummy _usb-bus-pointer)


Posted on the users mailing list.