The extern "C"
part tells a C++ compiler that the item being declared should use C linkage, which means that the name will not be mangled (or will be mangled in the same way that a C compiler would). This makes it so the item can be linked to from C code and most other languages as well, since C linkage is typically the standard used for that on a platform.
The __declspec(dllexport)
and __declspec(dllimport)
items are non-standard attributes that tell the compiler that the item should be exported (or imported) from a DLL. The __declspec()
attribute is supported on MS compilers and probably other compilers that target Windows. I'm not sure if GCC does or not. Other storage class attributes that can be specified with __declspec()
(at least in MSVC) include uuid()
, naked
, deprecated
and others that provide the compiler with information on how an object or function should be compiled.