Hi Simon, > silence C++ warnings ... > > typedef enum > { > ... > } Idna_rc; > ... > extern IDNAPI const char *idna_strerror (Idna_rc rc); > > ... allows future C++ code to be warning free.
It was said that the root problem is that your idna_* functions return an 'int', but idna_strerror takes an Idna_rc. This is inconsistent. There are three ways to fix this in a way that gets rid of the C++ warnings: 1) Change the return types from 'int' to 'Idna_rc'. Keep the enum as it is. 2) Change the argument type of idna_strerror to 'int'. Change the enum from typedef enum { ... IDNA_ICONV_ERROR = 9, ... } Idna_rc; to typedef int Idna_rc; #ifdef __cplusplus /* In C++ we avoid macros. */ ... const int IDNA_ICONV_ERROR = 9; ... #else ... #define IDNA_ICONV_ERROR 9 ... #endif 3) Keep the inconsistency as it is for C, but fix it for C++ only. Change the enum from typedef enum { ... IDNA_ICONV_ERROR = 9, ... } Idna_rc; to #ifdef __cplusplus typedef int Idna_rc; /* In C++ we avoid macros. */ ... const int IDNA_ICONV_ERROR = 9; ... #else typedef enum { ... IDNA_ICONV_ERROR = 9, ... } Idna_rc; #endif Bruno -- In memoriam Jerzy Popiełuszko <http://en.wikipedia.org/wiki/Jerzy_Popiełuszko>