空间首页 | 博客 | 好友分享 | 相册 | 存档 | 朋友和群组 | 个人资料
iSocceriRun
 

rainfly

 
文章分类
 
缺省  
 
标题搜索
 
 
 
Our Sponsors
 
 
快速导航
 
首页
论坛
Classified Search Engine
黄页/二手
北美个人空间
免费注册
登录
 
统计
 
点击: 174313
帖子数量: 215
开辟个人空间: 2011-08-11
最后更新: 2017-03-23
 
RSS订阅
 
 
 
 
 
 
 
 

CSharp大拿进来: C#调用C代码生成的DLL

文章内容
  2015-07-07 18:27:39  
C代码中的一个函数
代码:

...
__declspec(dllexport) void qwaAccGetVersion( const unsigned short* pusVersionArray[4], const char** pszVersionString, const char ** pszVersionComment )
...


C#中调用时引入
代码:

[DllImport("qwa_acc.dll", CallingConvention = CallingConvention.Cdecl)]
    public static extern void qwaAccGetVersion(
        [MarshalAs(UnmanagedType.LPTStr)] System.UInt16[] pusVersionArray,
        [MarshalAs(UnmanagedType.LPTStr)] string pszVersionString,
        [MarshalAs(UnmanagedType.LPTStr)] string pszVersionComment);
...


第一个参数写法肯定是错的.
[MarshalAs(UnmanagedType.LPTStr)] System.UInt16[] pusVersionArray,

但是应该怎么写?

谢谢
∽rainfly∽ 点击: 0 | 评论: 4 | 分类: 缺省 | 论坛: 电子电玩 | 论坛帖子
 
QR Code
请用微信 扫一扫 扫描上面的二维码,然后点击页面右上角的 ... 图标,然后点击 发送给朋友分享到朋友圈,谢谢!
分享:
分享到微信

文章评论

webdriver
无题

2015-07-07 18:46:52 | 引用
无题
LPTStr 是针对char Array的,你应该search UInt16 Pointer的Marshal rule

2015-07-07 18:48:57 | 引用
webdriver
rainfly
回复帖子
webdriver 写道:
LPTStr 是针对char Array的,你应该search UInt16 Pointer的Marshal rule


Still have no idea how.
researching...

2015-07-08 11:50:52 | 引用
回复帖子
webdriver 写道:
LPTStr 是针对char Array的,你应该search UInt16 Pointer的Marshal rule


how about this?
代码:

    [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 4)] UInt16[] pusVersionArray

2015-07-08 12:17:52 | 引用
rainfly

发表评论

The images, logos, trademarks used on this site and all forwarded content are the property of their respective owners.
We are not responsible for comments posted by our visitors, as they are the property of the poster.
All other content of this website is copyrighted by 加西网

 

加西网为北美中文网传媒集团旗下网站