I think putting the extern "C" block around the whole function ought to work. Please try it, then we don't need the duplication of the prototype...