Subject: Re: C++, GLUT, and function pointers.
To: Ingolf Steinbach <Ingolf.Steinbach@jena-optronik.de>
From: Richard Rauch <rkr@olib.org>
List: netbsd-help
Date: 09/11/2003 08:50:18
On Thu, Sep 11, 2003 at 12:03:12PM +0200, Ingolf Steinbach wrote:
> Hi, Richard.
>
> Richard Rauch wrote:
> > Is this considered a known bug? I thought that *static* member functions
> > could have their addresses taken just like "real" functions.
>
> I thought so, too. See
> http://groups.google.com/groups?hl=de&lr=&ie=UTF-8&selm=3A9BE21D.F3826AA7%40jena-optronik.de
Thanks!
So, if I understand the thread correctly, I can register this callback:
extern "C" static void callback_fun(int button, int state, int x, int y);
from my C++ class:
glutMouseFunc (callback_fun);
...and have callback_fun() call my class?
I tried something similar, but didn't have the {extern "C"} prefix.
It is interesting that the program runs most of the time, anyway.
Even with a {static} C++ member function. Most of the callbacks work,
and even the mouse-button callback works as long as I don't spin the
scroll wheel.
Thanks again.
--
"I probably don't know what I'm talking about." http://www.olib.org/~rkr/