Hi, I have been reading through the CRT design tutorial, and I noticed that a lot of the headers have extern "C" constructs such as:
Code: Select all
#ifdef __cplusplus
extern "C"
{
#endif
...
...
...
#ifdef __cplusplus
}
#endif
as far as I understand, the purpose of extern "C" is to avoid name mangling by C++ compilers, so that the functions prototyped between the brackets may be called by other C/asm modules.
However, in a lot of the header files, the extern "c" is used on a typedef or a #define directive, such as:
Code: Select all
#ifdef __cplusplus
extern "C"
{
#endif
typedef unsigned size_t;
#ifdef __cplusplus
}
#endif
What is the purpose of extern "C" in cases like this?