Am I missing something for WebAssembly creation in Oxygene?

Please, because otherwise we might be chasing long fixed issues, since 2293 is a month old and a lot of work has gone into the debug engine since then (and the template has been fixed too; the version this correct and should work with latest is the one without wasm32 in the HTML).

Ok, here is the result with 2305.

  1. Installed 2305.
  2. Started Water.
  3. Created a new Module (WebAssembly).
  4. Built with NO ERROR.
  5. Ran it and got error.

Here is what was in the bottom window of Water.

~> Process MyModule started.
!> Exception of type Error on thread 0001
!> Message: Error: Invalid response to request: Not Found
!>     at http://127.0.0.1:61732/wasm/RemObjectsElements.js:487:1234:

And this is where it put the build output:

C:\Users\mtied\Documents\RemObjects Software\Elements\Water\Try 5\MyModule\bin\Debug\WebAssembly\wasm32

Note the wasm32 again.

hmm… Here is the index.html

<html>
        <head>
                <title>MyModule Test Page</title>
                <script lang="javascript" src="wasm/RemObjectsElements.js"></script>
                <script lang="javascript" src="wasm/MyModule.js"></script>
        </head>
        <body>
        <h1>MyModule Test Page</h1>
        <div id="helloWorld"/>
        <script lang="javascript">
                MyModule.instantiate("wasm/wasm32/MyModule.wasm").then(function (result) {
                        console.log("WebAssembly file MyModule.wasm has been loaded.");
                        var program = result.Program();
                        program.HelloWorld();
                });
        </script>
        </body>
</html>

Interesting that the web module instantiation references wasm32 while the javascripts reference wasm.

Oh wait, my eyes spotted the wasm32, but I didn’t even see that it was “wasm/wasm32”. I think having both is almost certainly wrong.

Hmm, maybe we fixed this after 2305 went out. 'll check. Does it work if you remove the wasm32/?

I made all the references in the index.html be just “wasm”. The compiled output was put in “wasm32”, but, surprising to me, that combination worked.

Good. that makes sense. as mentioned earlier, wasm is a virtual subfolder in the web space that the debug http server adds, and it points to the folder containing the executable (which happens t be called wasm32 right now, since that’s the architecture name, but might in the future become, say wasm64 when running a 64bit version.)

Ok, so the current problem is just the “wasm32” in the html.

So how should this stuff be PUBLISHED? Do I create a “wasm32” folder when I copy it to the target production system? To I include the “DEBUG” or “RELEASE” parts of the path? Is there documentation that says what to do? Is there a plan to just put a Publish menu item there and output the correct stuff to some target folder?

Thanks for any elaboration on that process.

Also is there someplace that says that wasm is a virtual subfolder? Or is that just how you implemented it?

Yes. that should already be fixed, but i’ll double check to make sure it is for vNext. Note that all of this only matters for debugging from the IDE.

That’s really up to you and depends on where you wanna out stuff on your live server. as long as the relative path form your html to the .wasm file is correct, it’ll work. Think of the .wasm file the same as you would a .png. There’s really no rules where to out stuff in tur webspace, but as long as the path in the <img tag to the png is good, it’ll load. The same applies to the .wasm (and it’s helper .js)

That’d just a detail of the debug http server that tour debug engine launches, as a way to get both the build output and the Web\index.html into the same web space (even though they aren’t in the same folder hierarchy in disk)

Ok, I understand.

I guess you don’t plan on outputting to a server through a publish, but only manually constructing and copying files.

Thanks to both you and Carlo. Glad we got it all ironed out. I love this webassembly stuff for the web. Now if we could just get them to do xaml. I hate the inconsistency and other things about the whole html stuff. I was hoping they would fix it all for html 5, but unfortunately not.

Just a FWIW in your sample index.html, you may want to add a doctype for the file, and split start and end div tags since div is not a tag that is defined to be self closing. And the lang attribute on the javascript tag I think was deprecated quite a while ago in favor of type=“text/javascript” which can probably be dropped altogether since I think all the browsers have that type as the default (probably just in html5).