Forums

.NET 4.0 on Mono 2.10

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

.NET 4.0 on Mono 2.10

Postby Charles » Fri May 06, 2011 1:35 am

For those of you on Mac, Linux, etc. you can do this:
Code: Select all
$ mono --version
Mono JIT compiler version 2.10.2 (tarball Mon Apr 18 09:14:01 MDT 2011)

$ dmcs
error CS2008: No files to compile were specified

$ cd CobraWorkspace

$ svn up

$ cd Source

$ sudo ./bin/install-from-workspace -native-compiler:`which dmcs`

Note that the install-from-workspace script has a "Clean up workspace" task at the end that rebuilds the compiler in your workspace with debugging symbols, but fails to pass the extra args on (-native-compiler).

If you don't want to install, or if you want to get your workspace on .NET 4.0 after an install:
Code: Select all
$ ./bin/build -native-compiler:`which dmcs`

$  monodis --assemblyref cobra.exe
AssemblyRef Table
1: Version=4.0.0.0
   Name=mscorlib
   Flags=0x00000000
   Public Key:
0x00000000: B7 7A 5C 56 19 34 E0 89
2: Version=4.0.0.0
   Name=System
   Flags=0x00000000
   Public Key:
0x00000000: B7 7A 5C 56 19 34 E0 89

$ cobra -d -bsl

$ monodis --assemblyref Cobra.Lang.dll
# reports ... 4.0.0.0 ...

$ cobra hello
Hello, world.

$ monodis --assemblyref hello.exe
# reports ... 4.0.0.0 ...

# if you want to build Cobra.Lang.Compiler.dll:
$ ./bin/build-compiler-lib -v -native-compiler:`which dmcs`


This needs more testing. If you have questions or problems, speak up.

I'll work on Windows soon.

For your reference:
* http://stackoverflow.com/questions/2673234/net-4-0-new-methods-in-existing-classes
* What's New in the .NET Framework 4
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: .NET 4.0 on Mono 2.10

Postby Charles » Fri May 06, 2011 9:03 pm

I received this exception for one of my programs:
Code: Select all
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Reflection.Assembly.op_Equality'.
  at Cobra.Lang.Test.TestRunner.RunAllTests () [0x00000] in <filename unknown>:0
  at Cobra.Lang.CobraCore.RunAllTests () [0x00000] in <filename unknown>:0
  at CommandLine.Main () [0x00000] in <filename unknown>:0

I noticed the -compile-if-needed/-cin flag was being used. After removing the .exe, the error went away.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: .NET 4.0 on Mono 2.10

Postby Charles » Mon May 09, 2011 2:21 pm

I failed to mention that you'll probably want to include the -turbo option which turns off certain run-time checks and will therefore speed up the compiler and the standard library. So the command would be:

Code: Select all
sudo ./bin/install-from-workspace -native-compiler:`which dmcs` -turbo
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: .NET 4.0 on Mono 2.10

Postby RIGHT_THEN » Wed May 11, 2011 11:25 am

hey charles

what do you think of the 4) method described in this http://cobra-language.com/forums/viewtopic.php?f=4&t=766#p4011 to Make .net 4.0 compatible
using ILDASM and ILASM
i just tested it with Winform example from howtos and then disassembled the assembly/.exe produced
it indeed used .net 4.0 System.Windows.Forms and .net 4.0`s mscorlib
seems to work :o

Thanking_You
RIGHT_THEN
RIGHT_THEN
 
Posts: 99

Re: .NET 4.0 on Mono 2.10

Postby Charles » Wed May 11, 2011 11:57 pm

I think the method 4) is fine. Thanks for sharing it. In particular, it is good to know that even if we didn't have a textual C# back-end, we could still bump up the CLR version using that technique.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: .NET 4.0 on Mono 2.10

Postby Charles » Sat May 28, 2011 11:06 pm

I have added a -net4 option to the installer which makes this much easier. I've tested it on Windows+.NET and Mac+Mono. I'll post separately about it as well.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 78 guests