Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling C code for .NET [closed]

Tags:

c

.net

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

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

like image 618
Shahin Avatar asked Dec 16 '22 23:12

Shahin


1 Answers

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

You have a couple of options:

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

  2. Port the C code to .NET.

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

like image 80
Reed Copsey Avatar answered Dec 30 '22 23:12

Reed Copsey