[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Passing Scheme callbacks to Swig wraps.
From: |
Tony Sidaway |
Subject: |
[Chicken-users] Passing Scheme callbacks to Swig wraps. |
Date: |
Wed, 28 Feb 2007 10:23:19 +0000 |
I've been using Swig to wrap a medium sized C++ library. Part of the
task involves enabling the dynamic method pointers built into this
particular class hierarchy to be manipulated by the Scheme programmer.
As a concrete example, I want to enable the Scheme programmer to be
able override the menubar method with a method written as a Chicken
Scheme callback (define-external) procedure, by passing a pointer to
that callback to the setter for the C++ class's menubar function
pointer member.
To do this, the Swig code at some level needs to convert the callback
pointer of the method to a Swig pointer so that it can be passed to
the proxy class. I suppose if I were a Swig guru I'd write a Swig
typemap to do that. I'm not. Does anyone know whether that kind of
thing would be possible in Chicken Swig?
If not, I can still do it. I can write my own function, callable from
Scheme, to take a callback pointer and call SWIG_NewPointerObj(),
producing a new swig pointer object for the function pointer datatype.
It would be nice to know if anyone else has experience of these
issues. I'm feeling my way here.
- [Chicken-users] Passing Scheme callbacks to Swig wraps.,
Tony Sidaway <=