From owner-freebsd-hackers Wed Oct 27 16:43:35 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from picnic.mat.net (picnic.mat.net [206.246.122.133]) by hub.freebsd.org (Postfix) with ESMTP id 9CEA514D74 for ; Wed, 27 Oct 1999 16:43:22 -0700 (PDT) (envelope-from chuckr@picnic.mat.net) Received: from localhost (chuckr@localhost [127.0.0.1]) by picnic.mat.net (8.9.3/8.9.3) with ESMTP id TAA16487; Wed, 27 Oct 1999 19:42:16 -0400 (EDT) (envelope-from chuckr@picnic.mat.net) Date: Wed, 27 Oct 1999 19:42:16 -0400 (EDT) From: Chuck Robey To: Wes Peters Cc: tbuswell@acadia.net, Thomas David Rivers , freebsd-hackers@FreeBSD.ORG Subject: Re: X11/C++ question In-Reply-To: <381785C6.C0000EF1@softweyr.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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