C#定义C ++ DLL的结构 [英] C# defining a struct for C++ dll

查看:64
本文介绍了C#定义C ++ DLL的结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人能指出我正确的方向。我有一个c ++库,它暴露了以下结构和功能...



Hoping someone can point me in the right direction here. I have a c++ library which has the following struct and function exposed...

typedef struct nebisconfused_T
{
char myname;
char* cvalue;
char** allgivennames;
}nebisconfused;







addConfused(const int iFile, const nebisconfused* pSet);





我已经绕圈子了,似乎无法理解我如何定义将通过ok传递值的ac#struct或class使用addConfused。



只是那个让我头疼的allgivennames!



我是什么到目前为止已经完成了 - 尝试搜索c ++中搜索c ++ *和c ++ **的C#向量来搜索c#但是唉,我还是很困惑。



因此 - 如果有人可以提供任何帮助 - 解释什么char ** allgivennames /任何特定的搜索词我可以谷歌和/或指向一些好的示例代码,我可以学习如何排序,我很感激。



提前致谢。



I've been going round in circles and just can't seem to get my head around how I can define a c# struct or class that will pass the values through ok using addConfused.

it's just that allgivennames which is giving me a headache!

What I've done thus far - attempted to search for what a c++ * and c++ ** is in c# searched for C++ vectors to c# but alas, I'm still confused.

Thus - if anyone can help out with either - explaining what char** allgivennames is / any particular search terms I could google and/or pointers to some good example code I can learn from to get this sorted, I'd appreciate it.

Thanks in advance.

推荐答案

你有没有尝试过:

Hi, have you tried:

  • marshalling char* as String
  • marshalling char** as IntPtr and then use Marshal.PtrToStringAnsi Method (IntPtr).


这篇关于C#定义C ++ DLL的结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆