locked
C++ CLR needs msvcm90d.dll on Linux RRS feed

  • Question

  • Using Visual Studio 2008.

    I am trying to compile a C++ program using CLR so it runs on both Windows and Linux.

    It was compiled with the CLR option "Pure MSIL Common Language Runtime Support (/clr:pure)". It runs without a problem on Windows.

    Executing on Linux under Mono gets a DllNotFoundException for msvcm90d.dll.

    I try to compile the program with the static runtime library "Multi-threaded Debug (/MTd)" and get the compile error "'/MTd' and '/clr:pure' command-line options are incompatible".

    Is there a way to compile a C++ CLR program that is pure CLR and does not use microsoft DLLs so it can be run on Linux?

    If not, will this be changed in a future release, like VS 2010?

    Thanks
    Saturday, December 5, 2009 7:33 PM

Answers

  • Its not compiler issue its an OS issue, Mono and Mixed Mode Assembly Support .
    • Proposed as answer by Geert van Horrik Wednesday, December 9, 2009 10:11 AM
    • Marked as answer by jimp02 Wednesday, December 9, 2009 10:02 PM
    Saturday, December 5, 2009 8:43 PM
  • You need to use /clr:safe to get verifiable code which will have a chance to run on Mono/Linux.
    /clr:pure allows your code to have unmanaged data types, but only managed methods. Such code is allowed to call into native DLLs e.g. via PInvoke. When you ildasm assembly built with /clr:pure you can notice that it PInvokes into msvcm90*.dll (CRT). That's the reason why it doesn't work on Linux.

    See this for more info: http://msdn.microsoft.com/en-us/library/85344whh.aspx

    -Karel
    • Proposed as answer by Geert van Horrik Wednesday, December 9, 2009 10:11 AM
    • Marked as answer by jimp02 Wednesday, December 9, 2009 10:02 PM
    Saturday, December 5, 2009 9:54 PM

All replies

  • Its not compiler issue its an OS issue, Mono and Mixed Mode Assembly Support .
    • Proposed as answer by Geert van Horrik Wednesday, December 9, 2009 10:11 AM
    • Marked as answer by jimp02 Wednesday, December 9, 2009 10:02 PM
    Saturday, December 5, 2009 8:43 PM
  • You need to use /clr:safe to get verifiable code which will have a chance to run on Mono/Linux.
    /clr:pure allows your code to have unmanaged data types, but only managed methods. Such code is allowed to call into native DLLs e.g. via PInvoke. When you ildasm assembly built with /clr:pure you can notice that it PInvokes into msvcm90*.dll (CRT). That's the reason why it doesn't work on Linux.

    See this for more info: http://msdn.microsoft.com/en-us/library/85344whh.aspx

    -Karel
    • Proposed as answer by Geert van Horrik Wednesday, December 9, 2009 10:11 AM
    • Marked as answer by jimp02 Wednesday, December 9, 2009 10:02 PM
    Saturday, December 5, 2009 9:54 PM