[Mono-list] Running vs2005 beta 2 compiled code on mono...

Kornél Pál kornelpal at hotmail.com
Fri Jul 1 03:40:32 EDT 2005


> From: Alex Mohr
> I have the simplest C++/CLI program (main takes no args and just returns
> 0) that I can compile and run in VS2005.  I then try to run the program
> on a mac where I have installed mono, but it fails with an obscure error
> (unfortunately I don't have it in front of me now).

Ususally the error message is the most important thing because it explains
the error.:)

You probably get the error message 'Method '%s' in assembly '%s' contains
native code and mono can't run it. The assembly was probably created by
Managed C++.'

As the error message says Mono cannot run native code it can only run IL
code. The reason is quite simple: Native code is processor and operating
system dependent while IL code is platform independent.

C++ 2002 and 2003 cannot compile managed only code it allwasy contains some
native code even if you do not call any native funtions nor CRT and use your
own entry point to avoid CRT dependency. C++ 2005 is said to be able to
compile IL only assemblies but I have never tried it.

Kornél



More information about the Mono-list mailing list