How do I properly return a char * from an Unmanaged DLL to C#?

后端 未结 5 918
生来不讨喜
生来不讨喜 2021-01-06 08:57

Function signature:

char * errMessage(int err);

My code:

[DllImport(\"api.dll\")]       
internal static extern char[] errMessage(int err);         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-06 09:31

    Try using String in the managed side. you might as well set the CharSet to Ansi

提交回复
热议问题