Mixing Managed and UnManaged Code
-
I'd like to ask the general community their feelings/experiences pertaining to the use of placing managed code into existing un-managed projects/solutions (specifically, a MFC project). What have your experiences been - Positive or Negative? How much overhead does an un-managed project's code-base incur when managed code is inserted into an existing MFC un-managed solution? Know any good places to start for mixing managed and unmanaged code? Thank you, l2b
-
I'd like to ask the general community their feelings/experiences pertaining to the use of placing managed code into existing un-managed projects/solutions (specifically, a MFC project). What have your experiences been - Positive or Negative? How much overhead does an un-managed project's code-base incur when managed code is inserted into an existing MFC un-managed solution? Know any good places to start for mixing managed and unmanaged code? Thank you, l2b
I've had nothing but a positive experience mixing managed/unmanaged code. The largest overhead is the .NET framework, depending on how much of it you use. A good place to start is compiling your MFC code with the /clr switch. The only cpp modules that need to be compiled with /clr are the ones that have managed code. You can also control what gets compiled managed/unmanaged at the function level using the #pragma managed/ #pragma unmanaged directives. You'll of course want to understand managed programming and understand C++/CLI, which is esentially a different language than C++. .NET Programming Guide[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: