add extern funcs declaration and casts for cimpiling C++ compiler