Hello all,
I spent some time struggling to get callbacks working with SWIG, but
then decided that there must be an easier way than dealing with SWIG
pointers and C_save and C_callback. I came up with this (in pure scheme!):
-----------------
;compile this with csc
(use lolevel)
(define-external (dynfcn (double x)) double
((global-ref (string->symbol "myfunc")) x))
(load "rest-of-program.scm")
------------------
You can then re-define "myfunc" as many times as you wish inside of the
interpreted code "rest-of-program.scm". External C code can call
"dynfcn", and it will be dynamically bound inside chicken on each call.
Amazingly, this explicit dynamic binding with global-ref seems to work
fine.
Sincerely,
F. Rafael Leon
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users