I understand that when you include a c header in your c++ project you must wrap it with extern "C" because c++ and c have two different ways of identifying function. c will use the name to identify a function and c++ must use the name and the parameters to satisfy function overloading.
What I don’t understand is why are there are c headers that don’t require to be wrapped in extern "C" like windows.h??
In general, wrapping a C header in
extern "C"is not a good idea. The header might include other files that break when you do this. A C header that is designed to be used in C++ will handleextern "C"appropriately, without you having to do anything. Typical code: