What is webasssembly?
SteveT
Steve Litt
Autumn 2023 featured book: Rapid Learning for the 21st Century http://www.troubleshooters.com/rl21

Mailing lists / fpc-pascal / 2023-10
5 messages · 3 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
What is webasssembly?
SteveT
Steve Litt
Autumn 2023 featured book: Rapid Learning for the 21st Century http://www.troubleshooters.com/rl21
Steve Litt wroteWhat is webasssembly?
A bytecode format (similar to what is used in Java and C# runtimes) which is an open standard and which runs in all major browsers or in a host application.
Michael.
Michael Van Canneyt via fpc-pascal said on Wed, 11 Oct 2023 08:27:35 +0200 (CEST)
Does this mean I can code an application in Pascal and use webassembly to turn it into a web application? If so, could you please point me to some simple examples?
Thanks,
SteveT
Steve Litt
Autumn 2023 featured book: Rapid Learning for the 21st Century http://www.troubleshooters.com/rl21
Does this mean I can code an application in Pascal and use webassembly
to turn it into a web application? If so, could you please point me to some simple examples?
Without having WebAssembly used yet: As far as I understand, that should be possible.
The "entry point" is here: https://wiki.freepascal.org/WebAssembly
But I'd appreciate some more (and simple) examples, too. +1 for that :)
Michael Van Canneyt via fpc-pascal said on Wed, 11 Oct 2023 08:27:35 +0200 (CEST) Does…
Careful, there is no 'simple' in webassembly :-)
Basically, yes, this can be used to run a pascal program.
At the moment, all console applications will work in the browser, except for input, unless you use pre-prepared input.
Most packages in FPC that do not rely on external libraries will compile.
For demos:
In the pas2js project, there are demos under the 'wasienv' directory. You can adapt the helloworld example to load any .wasm file you want:
https://gitlab.com/freepascal.org/fpc/pas2js/-/tree/main/demo/wasienv/simple
You can do graphics using a HTML canvas (see the canvas demo), you can also manipulate the DOM. (see the job_* units in the 'dom' demo)
You cannot (yet) write a Lazarus LCL program and compile it to webassembly.
For those that also use Delphi, I'm currently working on porting FMX to Webassembly for my job, to be able to make full-fledged UI programs. The outcome is as yet uncertain, but we think it should be doable.
Michael.