Ian MacArthur wrote: > Michael Baeuerle wrote: > > > > Albrecht has mentioned the ABI and it looks like this is a problem for > > 'fl_filename_list()'. The sort functions are exported as C, but > > 'fl_filename_list()' is exported as C++. > > I have tried to statically link code that use the new 'filename.H' > > against an older library and this fails because the parameter types of > > the C++ function do not exactly match. For the C functions it works and > > there is not even a warning (as expected because I have restricted what > > the functions are allowed to do with the parameters). > > > > I'm not a C++ expert, is it possible to overload the function > > declaration without breaking other things? > > I suspect the "best" option here is possibly to revert the function > prototype to the non-const version...? > > I mean, change the typedef for Fl_File_Sort_F back to being non-const... > Would that do the trick, I wonder. > > It'd be less const-correct than the proposed code, but no worse than what > we had before. > > Thoughts?
Seems that we should not change the interface. Here is a reduced patch that don't touch the declarations at all: http://micha.freeshell.org/tmp/str_2931_r9827_v2.patch It can be built and executed but the Sun compiler gives this warning: ---------------------------------------------------------------------- Compiling filename_list.cxx... "filename_list.cxx", line 108: Warning (Anachronism): Formal argument compar of type extern "C" int(*)(const dirent**,const dirent**) in call to fl_scandir(const char*, dirent***, extern "C" int(*)(const dirent*), extern "C" int(*)(const dirent**,const dirent**)) is being passed int(*)(const dirent**,const dirent**). 1 Warning(s) detected. ---------------------------------------------------------------------- Looks like a C++ problem again, the function pointer has the wrong "style". Using a global variable declared as extern "C" don't solve the problem because the cast '(int(*)(const dirent**,const dirent**))' itself already have the wrong style inside a C++ function. Argh, I hate C++! Regards, Micha _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

