| [ 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 |
Subsystem: | FLUID |
Summary: | fluid: static functions v. static member functions |
Version: | 1.3-current |
Created By: | engelsman |
Assigned To: | engelsman |
Fix Version: | 1.3-current (SVN: v6727) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | engelsman 07:55 Jul 19, 2008 |
| This is a repost of http://www.fltk.org/newsgroups.php?gfltk.bugs+v:6808 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 http://www.fltk.org/str.php?L1473 | |
|
#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. | |
[ Return to Bugs & Features ]
|
| |