Wednesday, August 15, 2012

Hello Scala.net

Belatedly spotting the March '12 update to the Scala.net story, a very brief "Hello, World"

object HelloWorld {
def main(args: Array[String]) {
System.Windows.Forms.MessageBox.Show("Hello, .net world!")
}
}
view raw gistfile1.scala hosted with ❤ by GitHub

Build with

path\to\scala-bin\scalacompiler.exe -d path\to\output -target:exe -Ystruct-dispatch:no-cache -Xassem-name HelloWorld.exe -Xassem-extdirs path\to\scala-bin -Xshow-class HelloWorld -Xassem-path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll" hw.scala

where giving "." as path\to\output will put the new executable in the same folder as the scala compiler.

You now need to copy all the dlls (apart from mscorlib and the other System.* files) out of that folder into your output path folder. Then

path\to\output\HelloWorld.exe

and, suddenly:

Still slightly painful to actually perform the build, but definitely getting there. Still needs a stress-test.




No comments :