Re: XForms: c++, io_callback and idle_callback

Jacques Tremblay (
Wed, 29 Apr 1998 10:03:22 -0400 (EDT)

# To subscribers of the xforms list from Jacques Tremblay <> :

On Wed, 29 Apr 1998, Matthew Flax wrote:

.: Date: Wed, 29 Apr 1998 16:40:03 +1000 (EST)
.: From: Matthew Flax <flatmax@cse.unsw.EDU.AU>
.: Reply-To:
.: To:
.: Subject: XForms: c++, io_callback and idle_callback
.: # To subscribers of the xforms list from Matthew Flax <flatmax@cse.unsw.EDU.AU> :
.: I am using xforms in "C++" mode !
.: If I register either an io_callback or an idle_callback, I can not use
.: class member functions.
.: In other words I have to use global callback functions.
.: Does anyone know why ?
.: Could it be due to name mangling ?


this is normal because C++ member functions are passed
an implicit pointer (the 'this' pointer). XForms is a C library
and does not pass this pointer to callback functions. However, you
can register a static member function as a callback. Static member
functions are like global functions except that their name is
in the scope of the class. (e.g. MyClass::StaticMemberFunction)
My favorite option is to store the this pointer into the
u_vdata field of XForms objects. Then in the static callback, you
can retrieve the 'this' pointer.

Hope this helps.


To unsubscribe, send the message "unsubscribe" to or see
XForms Home Page:
List Archive: