如何在C#结构中调用/使用C结构 [英] How to call/use a C struct, in C# struct
本文介绍了如何在C#结构中调用/使用C结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我遇到问题,请帮助:
"C中有一个我想在C#中调用/使用的结构.这种情况就像我在C中有一个包含一些数据的结构,我需要在C#中的类似结构中使用它.
C struct的数据应传输到C#结构."
任何人都可以帮我解决这个问题,并可以为此编写代码段..这样它会更加有用.
您可以用一个小例子来解释..
谢谢
Dinesh
Hello all,
I am facing a problem, please help:
"There is a struct in C which i want to call/use in C#. The scenario is like i have a struct in C which has some data, which i need to use in a similar struct in C#.
The data of C struct should be transferred to C# structure."
Can anyone help me out with this and can write a code snippet for this..so that it will be more helpful.
You can explain with a small example..
Thank you,
Dinesh
推荐答案
实际上这不是很明显.我猜您在C ++中有一个.dll来保存一个结构,然后您想在C#程序中使用填充的C ++结构.
Hi,
It is not very obvious actually. I guess you have a .dll in C++ which holds a struct and then you want to use the filled C++ struct in a C# program. Is that right?
您必须在C#中使用DllImport才能使用由C ++创建的.Dll.
这是链接:
http://www.dotnetperls.com/dllimport [
Hi,
You must use DllImport in C# in order to use a .Dll which is created by C++.
here is a link:
http://www.dotnetperls.com/dllimport[^]
Cheers
跟随下面的链接
第一链接和
Hi,
follow below links
1st link and 2nd link
this example shows how to use your c/c++ library in c# code. i think through that you can get you answer.
thanks
-Amit.
这篇关于如何在C#结构中调用/使用C结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文