C++ does name mangling to implement types. The names of functions and variables are actually remapped into an implementation dependent encoding of the types of the functions, function parameters, and variables.
To access plain C variables and functions you need to tell the C++ compiler that the declarations are not supposed to have C++ name mangling. Most C headers in /usr/include have the following code in them to make them work with both C and C++.
Code:
#ifdef __cplusplus
extern "C" {
#endif
/* All of your C declarations go in here. */
#ifdef __cplusplus
}
#endif
Bookmarks