try this:
[DllImport("api.dll")]
[return : MarshalAs(UnmanagedType.LPStr)]
internal static extern string errMessage(int err);
...
string message = errMessage(err);
I believe C# is smart enough to handle the pointer and return you a string.
Edit: Added the MarshalAs attribute