fix build and add extern "C" to avoid name mangling.
they are nonstatic anymore.