简体   繁体   English

如何在VC#项目中集成VC ++项目?

[英]How to Integrate VC++ project in VC# project?

In VC++ we can use header files, but in VC# it's not possible. 在VC ++中,我们可以使用头文件,但是在VC#中,这是不可能的。 Is there any way to use the header file (.h file) in C#? 有什么方法可以在C#中使用头文件(.h文件)? I have defined some structures and #defines in .h file. 我已经在.h文件中定义了一些结构和#defines

How can I use all those structures & enums in a C# project and is it possible to integrate the C++ code in C#? 如何在C#项目中使用所有这些结构和枚举,是否可以在C#中集成C ++代码?

In .NET does not exist headers because all needed metadata is contained itself in referenced assembly. 在.NET中,不存在标头,因为所有必需的元数据本身都包含在引用程序集中。

And yes, you can integrate C++/C code by using a C++/CLI module. 是的,您可以使用C ++ / CLI模块集成C ++ / C代码。 C++/CLI can do managed and unmanaged code together in an assembly. C ++ / CLI可以在程序集中一起执行托管和非托管代码。 The C# can then use the C++ assembly almost as if it is C# code 然后,C#几乎可以像使用C#代码一样使用C ++程序集

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM