WASM and Node.js

I will make a list and go through data types, functions, enum

I don’t think enum worked. int works but it just doesn’t show up in .d.ts for me

1 Like

Thanks. I do think those “any” will probably need a bit of work yes.

The chosen language (C#, Java, and Oxygene eg) doesn’t matter and should behave the same way in how it compiles to WebAssembly and js right?

Correct.

I checked the types seen here: ElementsNode/Program.cs at master · Lelelo1/ElementsNode · GitHub

Decimal, Double, Long, ULong, DateTime are crashing for me.

Those commented out here: ElementsNode/run.js at master · Lelelo1/ElementsNode · GitHub

I get

RemObjects.Elements.System.Exception: No default constructor could be found on type

for Decimal, Double, Long, ULong.

When I remove getter and have it as field instead for properties: public long Long = 13; eg I get undefined for them, without crash.

When it comes to type declaration I get this:

export interface Program{
    String: any;
    Dynamic: any;
    Dictionary: any;
}

So we tried all your testcases, one thing I am curious about if you can explain the actual issue. I tried GitHub - Lelelo1/ElementsNode: Compiling REM Objects Elements project to WASM. Calling output with Node which runs just fine here. I tried calling some of the properties and they also seem to work. The only thing I see wrong here:

export interface Program extends RemObjects_Elements_System_Object{
    HelloWorld();
    Bool: boolean;
    Byte: number;
    SByte: number;
    Char: number;
    Double: number;
    Float: number;
    Int: number;
    UInt: number;
    NInt: number;
    NUInt: number;
    Long: number;
    ULong: number;
    Short: number;
    UShort: number;
    Object: RemObjects_Elements_System_Object;
    String: any;
    Dynamic: any;
    DateTime: RemObjects_Elements_RTL_DateTime;
    Dictionary: any;
}

is the string: any, which should be string (but calling it works fine). Can you help me? (Signatures should be fixed btw)

1 Like

Calling ULong I get:

Fatal exception in WebAssembly!
Exception: RemObjects.Elements.System.Exception: No default constructor could be found on type RemObjects.Elements.System.UInt64
wasm://wasm/019790da:1
RuntimeError: unreachable
at ElementsRaiseException (wasm://wasm/019790da:wasm-function[5473]:0x25a6a9)
at ms_t10__1sExternalCallse_RaiseExceptionnp_vnp_vno (wasm://wasm/019790da:wasm-function[5472]:0x25a4ce)
at ms_td_gMt6___1sType21_Instantiate____i01ta____1sBoehmGCnt7__1sType (wasm://wasm/019790da:wasm-function[3757]:0x1bf76d)
at ms_te__1sWebAssemblyc_InvokeMethodnp_vna_ont7__1sType (wasm://wasm/019790da:wasm-function[3777]:0x1c2545)
at mi_tnte__1sWebAssembly18__l__g_c____DisplayClass017__l_GetProxyFor_g_b____0nt13__1sEcmaScriptObject (wasm://wasm/019790da:wasm-function[3570]:0x1b46f6)
at mi_t29_gt8___1sFunc_t_2t12___1sEcmaScriptObjecto6_Invokent2_T1 (wasm://wasm/019790da:wasm-function[3342]:0x1aa079)
at mi_tnt13__1sEcmaScriptObject18__l__g_c____DisplayClass21a__l_DefineProperty_g_b____0nt13__1sEcmaScriptObject (wasm://wasm/019790da:wasm-function[3345]:0x1aa212)
at mi_t16__1sWebAssemblyDelegate6_Invokent13__1sEcmaScriptObject (wasm://wasm/019790da:wasm-function[2697]:0x17d57a)
at __island_call_delegate (wasm://wasm/019790da:wasm-function[5475]:0x25a739)
at res (/Users/lelelo1/Projects/ElementsNode/Bin/Debug/WebAssembly/wasm32/RemObjectsElements.js:291:66)

… for instance.

I think there must be some environment, dependency thing behind it. And again I don’t get the type declaration like you do

Can we get one consistent and complete test case that I can just open, run, to see the error? For example, your github project has no HTML, and the .js file is missing, so I have to apply any own guess work of what exactly to add/change to get it to build and repro the error — which by experience never works out well…

thanx!

The problem probably occurs during build. So you have to open the solution and build the project.

Then run node run.js which should be same as entry.js in bin folder. It’s in root folder just so that the code calling the properties don’t have to added after every build:

// ...
console.log(program.Bool);
console.log(program.Byte);
console.log(program.SByte);
console.log(program.Char);
// ... eg

The fact I get a different d.ts probably means there is something in the build that does it.There is probably no problem in calling of js with node afterwards.
Or maybe the missing d.ts for me and calling (crash for me) of some of the properties with node is separate I don’t know

What I think happen is that I get an incomplete wasm file, while you don’t for some reason

I can’t,

E: CopyToOutputDirectory file ‘/Users/mh/Downloads/ElementsNode-master/entry.js’ does not exist.

Yeah. It was a recent change I did. That file is not needed. So it should work fine if you just take that new changes from the repo or just delete that file. (I had not deleted it from inside Fire)

Again what the problem is for me is that I can’t call the wasm output in bin for certain of the declared properties. And I hardly get any type declaration in CompileTest.d.ts

Can you tell me the exact version you are using? my fixes are in last fridays build. v11.0.0.2749.

Leo,

can you zip up and attach a project that we can just,. with no fiddling and tweaking, can run and that will show the error you are seeing?

bugs://E25946 was closed as fixed. (static properties)

1 Like

There is no build errors. It’s calling the .wasm file with node that creates these errors.

Ok, then can i see a project that i can compile and run to see the errors?

When build now I don’t get entry.js anymore. I haven’t updated Fire. I created a build: ElementsNode/Bin/Debug/WebAssembly/wasm32 at master · Lelelo1/ElementsNode · GitHub

For me 3 properties could not be called from with node.js commented here: ElementsNode/run.js at 31d8b6069657f2acd3b97c743168ada9a0bc7240 · Lelelo1/ElementsNode · GitHub

There is absolutely in JavaScript in this project.

i hate to be a dick about this issue, but neither me or Carlo understand the problem. Can you please create a project that has everything (including the wasm and the consuming html/js (whether Node or Web doesn’t matter)) so we can just build, run and see it fail? And then zip that project up and attach it here? thank you. :pray:t3:

Otherwise, we will not be able to take action on this issue, sorry.

Here is a video what shows exactly what is happening for my side:

CompileWebAssembly.mp4

^^^

Also, the video is 45 seconds of this screen: