Question

I have to call my c method from c# coding.I have included .c file in our project.In c file i have test() method.I don't know how to call in c#. I don't want to convert my c project to dll file.

Était-ce utile?

La solution

I don't want to convert my c project to dll file.

You might not want to do that, but it's the only way. The most common solutions to your problem are:

  • Compile C code into unmanaged DLL and call it using p/invoke.
  • Compile C code into a COM server and use COM interop.
  • Wrap the C code in a C++/CLI mixed mode assembly which you can add to the C# project as a reference.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top