I have a C# VS10 project. I want its part to be pure C. So I will have pure C library and A C# file that will have part with C code calling that pure Lib.
So I’ll have C part of code – not precompiled DLL but C code and C# code files. So is it possible to have inside one C# file C code like we have C code inside C++ code?
like Inline C code inside C#…
(I know it can sound strange but I really need it)
Is it possible? Will I have posebilety to pass data from that C part to C#?
There’s a CIL backend for gcc and a few other attempts to build C to CIL compilers. These will produce standard .Net libraries which can be called from C#, but they will be in separate projects. (You’d need to compile the C project into a library and reference it – although you could later merge them into a single assembly if required.) Unfortunately the tools available for C to CIL development are almost severely lacking, so I’d question whether it’s worthwhile rather than just wrapping it up with p/invoke. You’re also going to get a performance slowdown using it, which is half the reason to use p/invoke rather than writing managed code anyway.