[plt-scheme] foreign.ss: callbacks in cstructs?

From: Jon Rafkind (workmin at ccs.neu.edu)
Date: Wed May 16 08:08:45 EDT 2007

> (defsvn svn-client-create-context (f : (_ptr o _svn-ctx-pointer)) 
> pool-pointer) -> _error-pointer -> f)
> (define (my-context (svn-client-create-context 
> (get-a-pool-from-somewhere)))))
> (set-svn-ctx-log-msg-func! my-context _svn-ctx (lambda () ...))
> All of this being completely untested of course..
For some reason I forgot that set-TYPE-SLOT! is defined as

(define (set-TYPE-SLOT! x slot)
(unless (TYPE? x)
(raise-type-error 'set-TYPE-SLOT! struct-string 0 x slot))
(ptr-set! x stype 'abs offset slot))

so that wont work since it uses ptr-set!..

Posted on the users mailing list.