changed the runtime functions to c++