views:

69

answers:

1

We use a software from another company for one of our products. A developer from that company is kinda 'old' and works in C (no offence). We work in .Net 3.5 (C#).

He asked me if it is possible, with the same source code (presumably in C, maybe C++), to create an assembly that he could compile both a managed and unmanaged version.

Are there any good reason to do this?

+1  A: 

In order to compile to managed assembly the code needs to be written using Managed C++ Extensions. Please note that C is not an OO language so you cannot compile to a managed assembly.

The primary reason for doing this is if you have an existing code base written in C++ that you want to use directly in .NET application without resorting to P/Invoke.

Darin Dimitrov