编译C $ C $下.NETNET

2023-09-03 04:09:00 作者:抱歉你没有资格

我如何编译C code在.NET中使用?

How can I compile C code for use in .NET?

目前是用C写的一个游戏;我怎么能转换成净code或将它的某些部分?

There is a game that written in C; how can I convert it to .Net code or use some parts of it?

推荐答案

您可以使用C code直接在.NET。

You can't use C code directly within .NET.

您有几个选项:

编译C code成一个动态链接库,并使用P /调用,以便从您的.NET程序中调用它。

Compile the C code into a dynamic link library, and use P/Invoke in order to call it from your .NET program.

港C code到.NET。

Port the C code to .NET.

总结使用C ++ / CLI(制作混合模式组件)的C code,并使用这些从内部选择你的其他.NET语言。

Wrap the C code using C++/CLI (making a mixed mode assembly), and use these from within your other .NET language of choice.