I'm working on a C++ GUI for freeciv. I need to make some calls into
the C component of client. The problem I'm running into is that the
freeciv header files are neither standard C or C++ compatible.

For example:
typedef enum a b;
enum a { A, B };

When this is compiled with g++ or 'gcc -pedantic' there will be an
error, if it is compiled with gcc there will be no error.

Given this problem, I see three possible solutions:
1) Quit
2) update the freeciv headers
3) write a C++ compatible wrapper for the functions I need.

#3 would be the easiest in the short term, but long term it will
require a significant amount of additional work to maintain. #2 is the
best in the long term, but has significant dangers. In updating the
headers, I could possibly introduce bugs or break features.

I'd like to do #2, with permission from the freeciv development team.
However, I'm also willing to do #3 if they feel it is unsafe.

#2 will probably involve me moving around some typedefs so that they
don't come before enum declarations and refactoring the code to
eliminate the use of 'class' as an identifier (as this is a C++
reserved keyword), perhaps other things.

Thank you for your time,
James Steven Supancic III

Freeciv-dev mailing list

Reply via email to