Is it possible to compile C code into a Visual C++ dll? I'm looking at using some C code with a .Net project and trying to determine whether this is even an option.
Thanks, Becky
Is it possible to compile C code into a Visual C++ dll? I'm looking at using some C code with a .Net project and trying to determine whether this is even an option.
Thanks, Becky
yes. If you want to get rid of name mangling use "extern "C" { /*...*/ }
construct.
Also, refer FAQ : How to mix C and C++
Given that C++ is largely backward compatible with C, you should be able to recompile the code using the C++ compiler unless the code uses some C99 features. However, keep in mind that C++/CLI is not standard C++ so there might be additional issues.
As aJ said, if you want to avoid the name mangling, you'll have to 'extern C' the symbols.
Another way to accomplish this would be to leave the C library as standard native code and write a thin C++/CLI layer for it. Then expose the C++/CLI layer to your .NET application.