Added extern "C" enclosure if linking with C++ compiler