fix compilation error: extern "C" from a cpp file
but the resulting programs hangs