I have the following exposed DLL functions in C++.
// center_of_rotation_api.h
// CENTER_OF_ROTATION_API is a macro like __cdecl(dllexport) on Windows
CENTER_OF_ROTATION_API void SerializeMesh(Mesh * mesh, const char * path);
CENTER_OF_ROTATION_API const char * SerializationError(Mesh * mesh);
From C#, I use the following.
// dll is the name of the compiled dll
[DllImport(dll)]
public static extern void SerializeMesh(IntPtr mesh, string path);
[DllImport(dll)]
public static extern IntPtr SerializationError(IntPtr mesh);
The IntPtr returned by SerializationError is allocated using new in C++. So I have another DLL exported function that frees the pointer when called by C#.
My question is, do I need to free the memory of the const char * path in the argument of SerializeMesh in C++?