Where I work, we have a lot of legacy C code that needs to be used in a QT project. As part of our coding standard, however, we have a rule that states that _any_ C header file must be framed by:
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
To copy to clipboard, switch view to plain text mode
and at the end of the header
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
To copy to clipboard, switch view to plain text mode
to ensure that we don't run in to problems with the different name mangling between C and C++. That wouldn't leave your original program untouched, I'm guessing, but it would avoid some of the potential problems of mixing the two.
Bookmarks