Thursday, April 21, 2011

In a Visual Studio C++ project with /clr, are its dependencies also compiled to managed code?

To be a bit more clear. If I have a Visual Studio C++ solution that has two projects, say a static library with CLR support turned off, and a second project with CLR support turned on that depends on this static library, does the static library get compiled as managed code? What about libraries that the CLR project uses that are external to this solution, do they also get compiled as managed code?

From stackoverflow
  • No, only the project with /clr gets compiled to a managed assembly. The static library will get compiled as unmanaged code and linked into the managed DLL.

  • No, your dependencies do not get compiled as managed code.

    Your "main" project actually ends up containing both managed and unmanaged code. Those parts when you call your dependency would be compiled as unmanaged.

0 comments:

Post a Comment