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

Alex Mohr amohr at cs.wisc.edu
Fri Jul 1 19:59:39 EDT 2005


>I have tried /clr:pure. If seems to be promising but I don't recommend using
>it. Just look at the resulting exe file using ildasm. It's full of imported
>functions from CRT. /clr:pure only means that you cannot declare unmanaged
>code but you can use it inline without P/Invoke.
>
>So the resulting code is still not entirely managed.
>
>Use /clr:safe instead. You have to be able to run it on Mono. It does not
>allow unmanaged code to be referenced and the assembly will be pure
>verifiable IL.

Thanks for all the info and advice.

Unfortunately /clr:safe just isn't a viable option.  You can't use any
native datatypes if you have this switch on.  You can't do: struct foo {
int bar, baz; };

Here's my perfect world:

We currently compile our low-level c++ libraries natively and we need to
continue to be able to do that.

To build our new software, ideally we could use our low-level libs in
the mid-level code by just compiling it all to IL (using /clr:pure).
This way the mid-level code could build .net objects for itself and the
higher-level stuff to use.  Then (ideally) we could run everywhere with
the same code (and possibly one build!) using mono.

Since this now seems impossible, I'm looking at other options:

I don't think we can use whidbey-style c++ interop because the only
c++/cli compiler is in visual studio.  P/Invoke seems bad because our
low-level libs are heavily object oriented c++ and P/Invoke seems to
only work well for c-style interfaces.

I'm struggling to figure out how to best do this sort of thing.

Alex


More information about the Mono-list mailing list