Ok thanks for the details. I will try to take a look into the function pointers and complete the list.
On Mon, Aug 15, 2011 at 4:55 PM, David Lowe <doctorjl...@verizon.net> wrote: > On 15 Aug, 2011, at 2:21 AM, patrick kelle wrote: > >> I might help David a bit if help is needed. > > I almost forgot this: > >> On 8 June 2011 10:48, Marko Lindqvist <cazf...@gmail.com> wrote: > > >> Easier, maybe even boring, task could be checking that all functions >> belonging to client common -> gui API go through function pointer >> layer. I just implemented it with minimum effort -> only those cases >> that caused actual compilation errors. I think that for consistency >> callback layer should be used even for those functions that don't >> cause compilation failures. In any case going through all these >> functions teaches one a lot about client common -> gui-specific >> interface. >> Function pointer layer exist to overcome different symbol mangling in >> C and C++. C-code, such as client common code, cannot call functions >> from C++ (gui-qt) with the usual convention of just giving function >> name as deep down the C and C++ have different idea what the name >> looks like even when in source code it seems the same. So gui-qt just >> sets up table of function pointers (C++ code itself can put those >> pointers correctly) and C-side uses those pointers to call functions. >> >> For example for gui-specific function ui_init(): >> - Actual implementation is in gui_main.cpp with name qtg_ui_init() >> (named so that prefix 'qtg_' is added) >> - qtg_ui_init() in header qtg_cxxside.h (all the functions accessed by >> function pointer layer are here) >> - In qtg_cxxside.cpp function setup_gui_funcs() sets function pointer >> funcs->ui_init (named after the gui-specific function) to point to >> qtg_ui_main() >> - In qtg_cside.h that pointer is defined to be part of gui_funcs-structure >> - In qtg_side.c is qt-client version of ui_init() that just calls >> qtg_ui_init() through function pointer (wraps it) > > Sent from my MacBookPro > > "Next time buy the two-ply kind," said Tom roughly. > _______________________________________________ Freeciv-dev mailing list Freecivfirstname.lastname@example.org https://mail.gna.org/listinfo/freeciv-dev