Re: [gtk-list] Re: Callback function troubles




   SORRY... I FORGOT to tell you that my "problem" and "solution" only
   occur
   when a class member function is used as the callback routine...
   Otherwise, I receive the data in the normal 3rd argument!!!!!!!!!!
   If this also the case for you, then we are at least a step closer!

This sounds like a conflict between C and C++ procedure calling
conventions.  Remember C++ passes an extra, hidden parameter called
``this'' to all procedures.  So all the parameters you're trying to
have passed up are getting bumped forward by one place, since the this
pointer isn't being put on the stack.

There are several fixes, all hinging on getting C++ to use C's
parameter passing mechanism.  Two that I know of are to declare
your handler static, or write it as

extern "C" {
    void init_arm_callback(GtkWidget *widget, GdkEvent *event,
                           command_struct *data) {
        ...etc...
    }
}
-- 
Joseph J. Pfeiffer, Jr., Ph.D.       Phone -- (505) 646-1605
Department of Computer Science       FAX   -- (505) 646-1002
New Mexico State University          http://www.cs.nmsu.edu/~pfeiffer






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]