[Mono-list] JScript and .NET classes

ftsw freethread.sw at gmail.com
Thu Feb 25 17:06:43 EST 2010


I'm using mono mjs compiler on a FreeBSD system. I'm not able to compile .NET
classes in JScript, only pure JScript language is compiled.

----------------------------------

EXAMPLE 1:

   import System;
   Console.WriteLine ("sample text");

compile it as follow

   # mjs /lib:/usr/local/lib/mono/1.0 /r:System.dll /out:test.exe test.js
   warning JS1135: Variable 'Console' has not been declared
   Compilation succeeded

and execute it

   # mono test.exe

   Unhandled Exception: Microsoft.JScript.JScriptException: Unexpected type:
value is null or undefined
      at Microsoft.JScript.Convert.ToObject (System.Object value,
Microsoft.JScript.Vsa.VsaEngine engine) [0x00000]
     at JScript 0.Global Code () [0x00000]
     at JScript Main.Main (System.String[] ) [0x00000]

----------------------------------

EXAMPLE 2:

   import System;
   import System.IO;
   var oFileInfo : FileInfo = new FileInfo ("/tmp/file.txt");
   if (oFileInfo.Exists)
      print ("it exists");
   else
      print ("it doesn't exists");

compile it...

   # mjs /lib:/usr/local/lib/mono/1.0 /r:System.dll /out:test.exe test.js
   test.js (4, 0): error: msg.no.semi.stmt

   Unhandled Exception: System.Exception: must create expr stm with
     at Microsoft.JScript.Parser.Statement (Microsoft.JScript.AST parent)
[0x00000]
     at Microsoft.JScript.Parser.Parse () [0x00000]
     at Microsoft.JScript.Parser.Parse (System.String source_string,
System.String source_location, Int32 line_number) [0x00000]
     at Microsoft.JScript.Parser.ParseAll () [0x00000]
     at Microsoft.JScript.Vsa.VsaEngine.Compile () [0x00000]
     at Mono.JScript.Driver.Main (System.String[] args) [0x00000]

----------------------------------

INFO on MONO

   Mono JIT compiler version 2.4.3.1 (tarball Wed Feb  3 12:27:12 CET 2010)
   Copyright (C) 2002-2008 Novell, Inc and Contributors.
www.mono-project.com
           TLS:           __thread
           GC:            Included Boehm (with typed GC)
           SIGSEGV:       normal
           Notification:  Thread + polling
           Architecture:  x86
           Disabled:      none

----------------------------------

I can only work in console with ssh & screen, cannot access documentation or
IDE. Anyone can help me or at least put me on the right path to find mjs
documentation?

many thanks

-- 
View this message in context: http://n4.nabble.com/JScript-and-NET-classes-tp1569842p1569842.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list