如何用C#编组 [英] How to marshaling with C#
本文介绍了如何用C#编组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[DllImport("DK_V2.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
//C++
int GetUs(void* con, uint32_t devId, char** ubjs, uint32_t* nid);
I convert above function to c# code as follow :
extern public static int GetUs(IntPtr con,out int devId,[MarshalAs(UnmanagedType.AnsiBStr), In] ref string ubjs, out int nid);
but that's wrong.
What I have tried:
I changed function variable datatypes but confront an error.
推荐答案
查看此CodeProject帖子!
使用C#进行编组
Check this CodeProject post!
Marshalling with C#
这篇关于如何用C#编组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文