Added extern calls with the extern keyword
Fixed bug in C codegen
merged from hj