From owner-freebsd-hackers Tue Oct 26 19:45:41 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 6720B14D27 for ; Tue, 26 Oct 1999 19:45:33 -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 WAA10564; Tue, 26 Oct 1999 22:44:58 -0400 (EDT) (envelope-from chuckr@picnic.mat.net) Date: Tue, 26 Oct 1999 22:44:57 -0400 (EDT) From: Chuck Robey To: Thomas David Rivers Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: X11/C++ question In-Reply-To: <199910270142.VAA31089@lakes.dignus.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 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message