سؤال

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.

هل كانت مفيدة؟

المحلول

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.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top