我必须在C#中编组指向结构的指针 [英] i have to marshal pointer to structure in C#

查看:53
本文介绍了我必须在C#中编组指向结构的指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要移植到c#的c ++ dll。有一个结构,其中有一个由指针指向的嵌套结构。

代码片段如下:

结构应用

{

struct hostent * hp;

};



由于我是编组概念的新手,请让我知道我有任何人掌握这种结构。

I have a c++ dll which needs to be ported onto c#. There is structure under which there is a nested structure which is pointed by a pointer.
Code Snippet is as follows:
Struct Application
{
struct hostent *hp;
};

Since i am new to the concept of marshalling, please let me know i anybody had hands on this kind of structure.

推荐答案

而不是将代码移植到C#字节的字节,而不是在.NET中寻找相同的功能框架。



hostent结构通常用于关联主机名和IP地址。



例如。 ..



Instead of porting the code over to C# byte for byte, look for equivalent functionality in the .NET framework.

The hostent structure is usually used to associate hostname and IP address.

For example ...

System.Net.IPAddress[] list = System.Net.Dns.GetHostAddresses("www.codeproject.com");


这篇关于我必须在C#中编组指向结构的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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