sq / JSIL

CIL to Javascript Compiler
http://jsil.org/
Other
1.73k stars 241 forks source link

Output failing with `Assembly has no entry point` #963

Closed ghost closed 8 years ago

ghost commented 8 years ago

I created a Hello World program referencing JSIL.dll and JSIL.Meta.dll.

using System;

namespace jsiltest
{
    class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

I compiled it with C:\JSIL\bin\JSILc.AnyCPU.exe --out=JSIL/ jsiltest.exe

This gives me 4 files in my output directory, jsiltest, Version=1.0.5938.18266, Culture=neutral, PublicKeyToken=null.js, jsiltest.exe.jsillog, jsiltest.exe.manifest.js, and mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.js.

So far everything works as expected.

Finally, I created my HTML page:

<!DOCTYPE html> 
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  </head>
  <body onload="onLoad()">    
    <script type="text/javascript">
      var jsilConfig = {

      };
    </script>
    <script src="../Libraries/JSIL.js" type="text/javascript"></script>

    <canvas id="canvas" width="1280" height="720">
    </canvas><br>

    <div id="log"></div>

    <script type="text/javascript">
      function runMain () {
        var asm = JSIL.GetAssembly("jsiltest");
        JSIL.InvokeEntryPoint(asm, []);
      };
    </script>
  </body>
</html>

However, when I load this in the browser I get the error:

Assembly has no entry point

kg commented 8 years ago

Hi,

You didn't load your assembly.

On April 4, 2016 11:21:07 AM PDT, 0xFireball notifications@github.com wrote:

I created a Hello World program referencing JSIL.dll and JSIL.Meta.dll.

using System;
namespace jsiltest
{
  class Program
  {
      public static void Main(string[] args)
      {
          Console.WriteLine("Hello World!");
      }
  }
}

I compiled it with C:\JSIL\bin\JSILc.AnyCPU.exe --out=JSIL/ jsiltest.exe

This gives me 4 files in my output directory, jsiltest, Version=1.0.5938.18266, Culture=neutral, PublicKeyToken=null.js, jsiltest.exe.jsillog, jsiltest.exe.manifest.js, and mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.js.

So far everything works as expected.

Finally, I created my HTML page:

<!DOCTYPE html> 
<html>
 <head>
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
 </head>
 <body onload="onLoad()">    
   <script type="text/javascript">
     var jsilConfig = {

     };
   </script>
<script src="../Libraries/JSIL.js"
type="text/javascript"></script>

<canvas id="canvas" width="1280"
height="720">
   </canvas><br>
   <div id="log"></div>
   <script type="text/javascript">
     function runMain () {
       var asm = JSIL.GetAssembly("jsiltest");
      JSIL.InvokeEntryPoint(asm, []);
     };
   </script>
 </body>
</html>

However, when I load this in the browser I get the error:

Assembly has no entry point


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/sq/JSIL/issues/963

  • kg (mobile)
ghost commented 8 years ago

Thank you for your response; however, how would I load the assembly?

kg commented 8 years ago

You'll need to include your assembly's manifest (generated by JSILc) in the jsilConfig, see here: https://github.com/sq/JSIL/wiki/jsilConfig I'm not sure why this is missing from the wiki tutorial...

On 4 April 2016 at 15:02, 0xFireball notifications@github.com wrote:

Thank you for your response; however, how would I load the assembly?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sq/JSIL/issues/963#issuecomment-205516473

ghost commented 8 years ago

Thanks, I got it working. This is definitely a non-issue, thanks for helping. Just wanted to say, this is a great project!