I see some code in C++ using extern "C"
at the beginning of the file like this:
#ifdef __cplusplus
extern "C" {}
#endif
What does this mean? How does it work?
Answer
It's probably not like that, but more like:
#ifdef __cplusplus
extern "C" {
#endif
//some includes or declarations
#ifdef __cplusplus
}
#endif
It tells the compiler to use C
name mangling for whatever is declared inside the directives.
The way you have it now:
#ifdef __cplusplus
extern "C" {}
#endif
is just dead code.
No comments:
Post a Comment