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

Alex Mohr amohr at cs.wisc.edu
Sat Jul 2 01:47:52 EDT 2005


>The new managed C++ syntax is a bit different than the old syntax but is
>more reliable.
>
>Use:
>ref struct foo {
>int bar, baz; };
>
>Or:
>value struct foo {
>int bar, baz; };
>
>You can use ref class and value class as well. IL does not have separate
>class and struct types so you can use any of the struct or class keyword
>they mean the same.
>
>ref creates an object reference while value creates a value class.

Right.  I'm only looking at the new c++/cli.  But we can't just change
all our existing code to do this.  It still needs to compile as regular
native code.

In whidbey, you can use existing "normal" c++ code like this (even with
/clr:pure) -- stuff just won't be .net objects.


>Native C++ libraries built for Win32 cannot be used on Mac anyway. So you
>have to compile them into IL or use a native Mac library that is called by
>the managed code using P/Invoke.

Yeah of course.  Most of our low-level c++ code is platform independent
-- it already builds natively on linux, mac, windows.  We just want to
start using it in a c++/clr like system.  P/Invoke doesn't work because
our libs are very heavily OO.

So yes, we want to compile it into IL, which is what /clr:pure does, but
apparently this isn't enough because assemblies compiled with /clr:pure
can still reference external non-IL things as you have explained.

We want to do this so we can take advantage of .net runtime stuff with
new code and so we can build a nice layer to write c# stuff on top of.


We want to start writing new code that does stuff like 'ref class foo
{};' but that uses our existing c++ code *without modification*.  VS.NET
2005 lets us do this with ease.  Mono unfortunately does not.  That's my
problem right now.


>Alternatively you can embed Mono into your application and in this case
>you can add InternalCalls that are managed methods but are implemented
>natively: http://www.mono-project.com/Embedding_Mono

Thanks for the pointer.

Alex


More information about the Mono-list mailing list