[gambit-list] calling interpreted scheme code from compiled C code

Frederick LeMaster fred.lemaster at gmail.com
Mon Jan 19 20:57:38 EST 2009


You could define a 'hook' the way emacs and guile do.

;wrapper.scm
(define disp-hook (list (lambda () (void))))

(define (add-hook hook thunk)
    (set-cdr! hook (cons thunk '())))

(define (run-hook hook)
    (for-each (lambda (p) (p)) hook))

(c-define (c-disp) () void "f" "" (run-hook disp-hook))

;test.scm
(load "graphics")

(define (disp)
  (glClear GL_COLOR_BUFFER_BIT)
  (glutWireTeapot 0.5))

(add-hook disp-hook disp)

On Mon, Jan 19, 2009 at 5:43 PM, symbolic expression
<symbolic.expression at gmail.com> wrote:
> so the question is ... how can i get compile scheme code to 'wait' in order
> to call interpted scheme code?
>
> thanks!



More information about the Gambit-list mailing list