Sign in Join
Wiki copytemporary

WebAssembly: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# WebAssembly
22
3-WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. See the [WebAssembly](https://webassembly.org) website for more information.
3+WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. See the [WebAssembly](<https://webassembly.org>) website for more information.
44
55# Free Pascal and WebAssembly
66
7-FPC supports two Wasm compilation targets: WASI and embedded. See [[WebAssembly/Compiler]] on how to build and install FPC for Wasm.
8-
9-[WASI](https://wasi.dev) - the WebAssembly System Interface - defines an API for operating system-like features, including files and filesystems, network sockets, clocks and random numbers. These features, when implemented in web browsers as well as standalone Wasm runtimes on desktops, servers, and serverless cloud computing units, are available to Pascal programs and libraries compiled by FPC to Wasm for the WASI target.
10-
11-The FPC WASI RTL consists of these units:
12-
13-- fcl-base
14-- fcl-css
15-- fcl-db
16-- fcl-hash
17-- fcl-js
18-- fcl-json
19-- fcl-mustache
20-- fcl-passrc
21-- fcl-registry
22-- fcl-sdo
23-- fcl-sound
24-- fcl-stl
25-- fcl-xml
26-- hash
27-- libtar
28-- regexpr
29-- rtl
30-- rtl-extra
31-- rtl-objpas
32-- rtl-unicode
33-- symbolic
34-- tplylib
35-- webidl
36-
37-The FPC Wasm embedded RTL consists of these units:
7+FPC supports three Wasm compilation targets: WASIp1 (WASI 0.1, also known as WASI Preview 1), WASIp1threads (WASI 0.1 with the wasi-threads proposal) and Embedded. See [[WebAssembly/Compiler]] on how to build and install FPC for Wasm.
388
39-- rtl
40-- rtl-extra
41-- tplylib
9+[WASI](<https://wasi.dev>) \- the WebAssembly System Interface - defines an API for operating system-like features, including files and filesystems, network sockets, clocks and random numbers. These features, when implemented in web browsers as well as standalone Wasm runtimes on desktops, servers, and serverless cloud computing units, are available to Pascal programs and libraries compiled by FPC to Wasm for the WASI target.
4210
43-With respect to the embedded target, there are presently (2022) early efforts to create Wasm-related standards for cross-device/platform/architecture embedded applications.
11+With respect to the embedded target, there are presently (2022) early efforts to create Wasm-related standards for cross-device/platform/architecture embedded applications.
4412
45-Overall, FPC's Wasm support adds to FPC's already [extensive list of compilation targets](https://www.freepascal.org/), potentially allowing Pascal programs to run in even more environments than they already do.
13+Overall, FPC's Wasm support adds to FPC's already [extensive list of compilation targets](<https://www.freepascal.org/>), potentially allowing Pascal programs to run in even more environments than they already do.
4614
4715# Demos
4816
4917## Running in Web Browsers
5018
51-In each demo, the driver program is transpiled from Pascal to Javascript using [[pas2js]], and the worker program/library is compiled from Pascal to Wasm using FPC WASI target.
19+In each demo, the driver program is transpiled from Pascal to Javascript using [[pas2js]], and the worker program/library is compiled from Pascal to Wasm using FPC WASI target.
5220
53-- [Simulated terminal input and output](https://www.freepascal.org/~michael/pas2js-demos/wasienv/terminal/)
54-- [Drawing on HTML canvas](https://www.freepascal.org/~michael/pas2js-demos/wasienv/canvas/)
55-- [Conway's Game of Life](https://github.com/PierceNg/wasm-demo/)
21+ * [Simulated terminal input and output](<https://www.freepascal.org/~michael/pas2js-demos/wasienv/terminal/>)
22+ * [Drawing on HTML canvas](<https://www.freepascal.org/~michael/pas2js-demos/wasienv/canvas/>)
23+ * [Conway's Game of Life](<https://github.com/PierceNg/wasm-demo/>)
5624
57-The Free Pascal compiler itself run in the browser: ![](/wiki-images/f/f2/Fpcwasm-1.png)
25+The Free Pascal compiler itself run in the browser: [![fpcwasm-1.png](/wiki-images/6/64/fpcwasm-1.png)](</File:fpcwasm-1.png>)
5826
27+For more information on how to build and use the native WebAssembly compiler, see: [[WebAssembly/Native Compiler]]
28+
5929## With Standalone Runtime
6030
61-Free Pascal's source tree contains [examples](https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/wasmtime/examples) embedding the [wasmtime](https://github.com/bytecodealliance/wasmtime) standalone Wasm runtime in Pascal host programs.
31+Free Pascal's source tree contains [examples](<https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/wasmtime/examples>) embedding the [wasmtime](<https://github.com/bytecodealliance/wasmtime>) standalone Wasm runtime in Pascal host programs.
6232
6333# See Also
6434
65-- [[WebAssembly/Compiler]]
66-- [[WebAssembly/Roadmap]]
67-- [[WebAssembly/JS]]
68-- [[WebAssembly/Files]]
69-- [[WebAssembly/DOM]]
70-- [[WebAssembly/Threads]]
71-- [[WebAssembly/JS-Promise Integration]]
72-- [[WebAssembly/Reference types]]
35+ * [[WebAssembly/Compiler]]
36+ * [[WebAssembly/Native Compiler]]
37+ * [[WebAssembly/Debugging]]
38+ * [[WebAssembly/Roadmap]]
39+ * [[WebAssembly/JS]]
40+ * [[WebAssembly/Exceptions]]
41+ * [[WebAssembly/Files]]
42+ * [[WebAssembly/DOM]]
43+ * [[WebAssembly/Threads]]
44+ * [[WebAssembly/JS-Promise Integration]]
45+ * [[WebAssembly/Reference types]]
7346
74-There is an external pet project to create a pascal interpreter, not related to Free Pascal:
47+There is an external pet project to create a pascal interpreter, not related to Free Pascal:
7548
76-- [Making a budget Pascal compiler to WebAssembly](https://faizilham.github.io/making-budget-pascal-compiler)
49+ * [Making a budget Pascal compiler to WebAssembly](<https://faizilham.github.io/making-budget-pascal-compiler>)
7750
7851---
79-*From the Free Pascal wiki, page "WebAssembly", as it stood on 2023-10-22 after a change by Michael, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
80-Category: WebAssembly
52+*From the Free Pascal wiki, page "WebAssembly", as the Internet Archive kept it on 2026-09-26, last changed on 2025-10-06. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history