Boost logo

Boost Users :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2006-06-30 14:22:18


On 6/30/06, Stephen Torri <storri_at_[hidden]> wrote:
> On Fri, 2006-06-30 at 11:04 -0700, Cory Nelson wrote:
> > > What I am getting back from the g++ compiler is the following error message:
> > >
> > > error: cannot convert `boost::function<void ()(), std::allocator<void> >' to `void (*)()' for argument `1' to `void glutDisplayFunc(void (*)())'
> > >
> > > Any ideas where I am going wrong?
> >
> > You are passing a function object to a C function which expects a
> > function pointer. A boost::function can not be converted into a
> > function pointer.
>
> I appreciate the response pointing out the error. It would be nice to
> have a solution and not just a critique.

Glut was poorly designed in that respect (not giving an option to pass
a user data pointer) - in this case there is no solution other than
making your function object global and have a C function which calls
it. You could always modify your glut source, it sounds like an easy
enough patch.

> Stephen
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Cory Nelson
http://www.int64.org

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net