In libxmi/xmi/xmi.h, there are 2 ___BEGIN_DECLS and only 1 ___END_DECLS
(#define-s of the preprocessor symbols themselves not included).
(___BEGIN_DECLS is defined as 'extern "C" {' and ___END_DECLS as '}'
conditionnally on __cplusplus.)


Unpaired ___BEGIN_DECLS and ___END_DECLS leads a C++ compiler to
compile-time errors (apparently, extern "C" blocks can be nested). Hence,
xmi.h contains a bug that only appears when libxmi is used with C++ code.
Adding one ___END_DECLS (in some sensible place) solved the problem for
me. However, the usage policy of these declarations is not totally clear
to me. Should the entire header file be inclosed by extern "C" { ... } or
only the _procedures_ declarations (hence leaving the enum definitions to
be processed in C++ mode) ?

In other words, do you know the reason to use these ___{BEGIN,END}_DECLS
macros and not constructs like the following ?

#ifdef __cplusplus
extern "C" {
#endif

... The entire header here ...

#ifdef __cplusplus
}
#endif


BTW, last question: why are there 3 '_' in the macro name ?
 ;-))

Rodolphe


Reply via email to