Function signature:
char * errMessage(int err);
My code:
[DllImport(\"api.dll\")] internal static extern char[] errMessage(int err);
See this question. To summary, the function should return an IntPtr and you have to use Marshal.PtrToString* to convert it to a managed String object.