C#调用C接口字符参数编码的问题解决方法

1、传入单字节ANSI字符

[DllImport("hostIO", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]

    public static extern int initHost([MarshalAs(UnmanagedType.LPStr)] string host);


2、传入双字节Unicode字符

[DllImport("hostIO", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern int initHost([MarshalAs(UnmanagedType.LPWStr)] string host);

C#调用C接口字符参数编码的问题解决方法

上一篇:SOFT-SLAM系列论文解读


下一篇:【Lua、LuaJIT、tolua++、lua for windows】这几个到底有什么关系?!