On Tue, 26 Oct 1999, Thomas David Rivers wrote:

> > 
> > Does anyone (anyone, that is, who's coded X11 applications) know how you
> > handle X11 callbacks to C++ object methods?
> > 
> > Thanks,
> 
>  If you mean Xt (and possibly Motif) - the answer is "very carefully."
> 
>  The Xt callbacks are C based, so you typically can't directly call a 
>  C++ method.
> 
>  But, you can have an extern "C" block that declares the call back
>  function (the extern "C" basically keeps any name mangling from going on)
>  and then, in that function, invoke the method as appropriate.
> 
>  I believe you do something like:

[example deleted]

Then you just stick a C wrapper function around every C++ callback you
want to register, is that it?  Seems a bit inelegant, but I suppose, if
the ultimate test of elegance is that "it's the only one that works", then
it's perhaps elegant *enough*.

----------------------------------------------------------------------------
Chuck Robey                | Interests include C programming, Electronics,
213 Lakeside Dr. Apt. T-1  | communications, and signal processing.
Greenbelt, MD 20770        | I run picnic.mat.net: FreeBSD-current(i386) and
(301) 220-2114             |       jaunt.mat.net : FreeBSD-current(Alpha)
----------------------------------------------------------------------------



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to