Add/fix support for usage as library.
Protect headers from C++ name mangling.