how to use a C# dll like a C dll

  • Thread starter Thread starter Relaxin
  • Start date Start date
R

Relaxin

I want to create some DLL's in C# but they must be used in a C program.

How do I create the exports for the C# dll and how would I access them from
a C executable or DLL.

If it can't be done using C, then how do you do it if you are using C++ ?

P.S. The C program is a Windows program.
 
You can't access them as though they were a plain Win32 DLL because they
aren't. However, you can build a non-managed C++ app (don't know about C,
sorry) and tell the linker to include common language runtime support
(/clr). You would then add a reference to your C# library and then be able
to access it. Just beware that standard C++ and .Net assemblies are very
different beasts, so you'll be dealing with all sorts of fun issues
surrounding the passing of data back and forth.

Also, so far as I know this will only work with Microsoft compilers .Net
support is something they added. Other compilers such as Borland's and
Intel's may have added similar support but I don't use them so don't know.
 
Back
Top