Added extern "C" to work with g++ correctly.