Julien Poulin
Julien Poulin

Reputation: 13015

Is it possible to make both a managed and unmanaged versions of the same C++ assembly?

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?

Upvotes: 1

Views: 153

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

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.

Upvotes: 2

Related Questions