add external function declaration
add typecast for c++