// Converts C style string to NSString NSString* CreateNSString (constchar* string) { if (string) return [NSString stringWithUTF8String: string]; else return [NSString stringWithUTF8String: ""]; }
// Helper method to create C string copy char* MakeStringCopy (constchar* string) { if (string == NULL) returnNULL; char* res = (char*)malloc(strlen(string) + 1); strcpy(res, string); return res; }
// When native code plugin is implemented in .mm / .cpp file, then functions // should be surrounded with extern "C" block to conform C function naming rules extern"C" {