STR #2011

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]

STR #2011

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:2 - Specific to an operating system
Summary:fluid: static functions v. static member functions
Created By:engelsman
Assigned To:engelsman
Fix Version:1.3-current (SVN: v6727)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Name/Time/Date Filename/Size top right image
#1 engelsman
07:55 Jul 19, 2008
#2 engelsman
07:55 Jul 19, 2008
#3 engelsman
08:06 Jul 19, 2008
bottom left image   bottom right image

Trouble Report Comments:

Name/Time/Date Text top right image
#1 engelsman
07:55 Jul 19, 2008
This is a repost of
where I screwed up and sent to the mailing list rather than adding an STR.

I noticed that if I set the window callback to onWindowClose_ and
provided a static member function onWindowClose_ that called the
[protected] member function onWindowClose, then doxygen generates
entries for both.

If I change this so that onWindowClose_ is a static function that
calls the [public] onWindowClose member function, doxygen does not
generate an entry for onWindowClose_. Great! Information hiding :-)

So then I tried to migrate the other callbacks to the same scheme.
I set the File/Quit menu item callback to onFileQuit_ and changed
onFileQuit_ from being a static member function to a static function,
and then I get the following message when I try to compile with g++:
  error: overloaded function with no contextual type information

I can track this down to a spurious declaration in the header file:
  extern void onFileQuit_(Fl_Menu_*, void*);
If I delete this line manually, I can compile and run.

See the works.fl and fails.fl examples below.
#2 engelsman
08:05 Jul 19, 2008
I've been through the debugger and produced a patch that appears
to work with Linux/g++ but I can't test on other platforms.

It adds a 'user_defined(cbname)' member function to Fl_Type that scans
to see whether any Function block matches the given callback name. It
is only called Fl_Menu_Item_Type::write_static() because this is where
I have had problems, and because Fl_Widget_Type:write_static() already
has some convoluted logic to handle this (and probably better!).

The patch does not check that the Function is a plain function or a
member function from the same class, nor does it check the parameter
types. As I haven't worked out the complete fluid architecture yet,
I don't know whether it needs to or not. I leave that to the experts.
#3 engelsman
01:38 Jul 20, 2008
I think this "solves" FLTK2 STR  
#4 engelsman
13:10 Mar 27, 2009
Fixed in Subversion repository.

added check whether function name has been declared somewhere else
by the user. should probably check more details to be really safe.
bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.