[Mono-list] Running vs2005 beta 2 compiled code on mono...
kornelpal at hotmail.com
Sat Jul 2 07:30:01 EDT 2005
Altough /clr:pure really produces pure IL code it's not platform independent
Non __clrcall functions can be invoked in a pure MSIL component, but not
Msvcm80[d].dll, Msvcurt[d].lib: The DLL is a mixed assembly providing
managed C Run Time (CRT) support, and is part of a managed assembly
installed in the global assembly cache (GAC).
msvcurt.lib, msvcm80.dll: C Runtime import library compiled as 100% pure
MSIL code. All code complies with the ECMA URT spec for MSIL.
Even the assembly compiled using /clr:pure contains P/Invoke references to
Windows API functions like GetProcaddress in kernel32.dll. It references the
CRT: msvcr80.dll (native DLL) msvcm80.dll (mixed assembly with a lot of
functions implemented natively) as well and imports a bunch of CRT functions
that are implemented entirely in native code. Furthermore it is flagged as
ILONLY || 32BITREQUIRED so I think the IL code itself is processor dependent
as well (requires 32-bit processor).
So the code is not platform independent but contains only IL that Mono
This does not solve your problem because the entire msvcr80.dll should be
implemented in a platform independent open source module to can use
/clr:pure assemblies on Mac but /clr:pure can be executed on Mono/Windows as
well because neither msvcr80.dll nor msvcm80.dll call mscoree.dll functions.
You cannot use the CRT if you want to compile platform a independent
assembly written in C++ and has to use /clr:safe becase /clr:pure wants to
import ?.cctor@@$$FYMXXZ even if you don't use CRT at all (neithe CRT entry
point nor any CRL function). If you could create you own function with this
signature it would result in a platform independent code however if you use
no CRT functions in addition.
So I think your only chance is to separate native code from managed code.
And compile managed code either using /clr:safe or C#.
More information about the Mono-list