How can I create one Visual Studio project that mixes C and C ++ using the CLR?

I am working on porting code that builds on GCC to Unix for Windows using Visual Studio 2008. I would like to create a single executable file that does not depend on any dll (s) of my own creation and only built into the Windows operating system .

My code includes zlib, which itself includes C files that I can create and link in my Unix executable.

In my early attempt to build, the first error I hit was that C code from zlib could not be created with the CLR, since it is not C ++.

I see that some suggest splitting this into a separate DLL that will be associated with my executable, but I would like, if possible, to avoid the complexity of shared libraries. (Perhaps this evasion is even more complicated?)

Is there a way to mix my C ++ with C zlib code into a single executable with the CLR?

My current build error is as follows:

1>cl : Command line error D8045 : cannot compile C file '..\src\zlib-1.2.5\zutil.c' with the /clr option 
+4
source share
1 answer

You can change it to cpp to compile it with a C ++ compiler (and fix any compilation errors that appear). This can be trickier than just using a shared library (dll).

+3
source

All Articles