[plt-scheme] ffi circular dependency

From: gabor papp (gabor.lists at mndl.hu)
Date: Fri May 15 17:38:57 EDT 2009


I'm tring to wrap a C structure and a function pointer which have
circular dependency:

struct cpBody;
typedef void (*cpBodyVelocityFunc)(struct cpBody *body);

typedef struct cpBody{
    cpBodyVelocityFunc velocity_func;

I'm not sure how to solve this. Is forward declaration possible somehow?

(define _cpbody-velocity-func
  (_fun (body : _cpbody-pointer)
        -> _void))

(define-cstruct _cpbody (
    [velocity-func _cpbody-velocity-func]))

Any help would be appreciated.


Posted on the users mailing list.