move CPP -> C calls inside class defintion for generated code