Date: Wed, 27 Oct 1999 19:42:16 -0400 (EDT) From: Chuck Robey <chuckr@picnic.mat.net> To: Wes Peters <wes@softweyr.com> Cc: tbuswell@acadia.net, Thomas David Rivers <rivers@dignus.com>, freebsd-hackers@FreeBSD.ORG Subject: Re: X11/C++ question Message-ID: <Pine.BSF.4.10.9910271940320.29073-100000@picnic.mat.net> In-Reply-To: <381785C6.C0000EF1@softweyr.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 27 Oct 1999, Wes Peters wrote: > Chuck Robey wrote: > > > > On Tue, 26 Oct 1999 tbuswell@acadia.net wrote: > > > > > > > > Thomas David Rivers writes: > > > > If you mean Xt (and possibly Motif) - the answer is "very carefully." > > > [...] > > > > > > You're approach would probably work, but there's an easier way. > > > See topic 28 in the Xt FAQ. > > > > > > ftp://ftp.x.org/contrib/faqs/FAQ-Xt > > > > > > It's not name mangling causing problems, it's lack of "this" when the > > > method is invoked as a callback from Xt. > > > > Yes! This is the method! I like it, or at least, it's as close (in C++ > > code) to something I do like. > > I assume they're using a static member function for the callback and storing > the this pointer for the object somewhere handy? This is the canonical way > to re-enter C++ code from C land, and can even be used for C++ interrupt > handlers if you're very careful. Yes, you store the address of the object you want the callback vectored to in the UserData Xt pointer, and when the callback comes into the static func, it just takes the offered object address and reflects the call back out to the right function in the right object. Neat, the user never sees any complication at all. > > ---------------------------------------------------------------------------- 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9910271940320.29073-100000>