-3

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.

user2995210
  • 59
  • 1
  • 3
  • 11

1 Answers1

1

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.
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490