Forum > Pas2JS

pas2js wasm demos throw 'unimplemented TPas2JSWASIEnvironment.fd_prestat_get'

(1/1)

PierceNg:
Anyone has success running pas2js WASI demos?

I'm using pas2js and fpcwasm compilers built yesterday from respective current trunk/master/main. Running pas2js's demo/wasienv/simple, web page shows up with expected output; browser console has following:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---> XHR GET http://localhost:20080/helloworld.wasmUnimplemented: TPas2JSWASIEnvironment.fd_prestat.getHello world from FPC webassembly and Pas2JS!... and a merry Christmas for all!

Next, copied helloworld.wasm over to demo/wasienv/wasiapp and ran that. Now web page doesn't show expected output, and browser console:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---> XHR GET http://localhost:20080/helloworld.wasmUnimplemented: TPas2JSWASIEnvironment.fd_prestat.get<empty string>

Same 'unimplemented ...' shows up for every demo in demo/wasienv. These fd.prestat.get calls are made by FPC-generated Wasm (I guess) and the function is not implemented by pas2js's WASI, as per line 924 in packages/wasi/wasienv.pas. 

cai:
WASI is unimplemented in standard browser app(BS app), that is WASI designed(for CS App), we can not access local file in the browser world! means all document code in browser app can not call WASI to do something, unless a browser implement WASI, but it is not safety for user local data.

Navigation

[0] Message Index

Go to full version