Catalog · How the catalog works
wasm-fpc-examples
Examples of WASM Using FPC
- ★ 4 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
🧩 WebAssembly Examples with Free Pascal (FPC)
This repository demonstrates how to create and use WebAssembly (.wasm) modules compiled from Free Pascal code. The examples showcase how to export functions from Pascal and call them in a web browser using JavaScript.
📁 Project Structure
├── hello.pas # Free Pascal source code exporting a 'Hello World!' function
├── hello.wasm # Compiled WebAssembly binary
├── *.wasm # |_
├── http_server.pas # http server unit
├── http_servers.lpi # |
├── http_servers.lpr # ├──lazarus project files
├── http_servers.lps # |
├── index.html # Simple HTML page to load and run the WebAssembly
├── index.js # JavaScript loader for the WASM module
└── README.md # This file🚀 Getting Started
1. Compile the Pascal Code
Make sure you have Free Pascal (with WebAssembly support) installed.
Compile the Pascal source to WebAssembly:
ppcrosswasm32 -Twasi -ohello.wasm hello_wasm.pas2. Serve the files
You need to serve these files over HTTP to load WebAssembly in the browser.
fpc -ohttp_server http_servers.lpr #and other options that may applied
./http_server
HTTP Server running at http://localhost:8080🛠️ Author & License
Created by herux. Licensed under the MIT License.

