• Stars
    star
    516
  • Rank 85,726 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

How to create minimal wasm module with plain C/C++

howto-wasm-minimal

How to create minimal wasm module - PoC

Goals

  • use no Emscripten or any libs
  • simple toolchain, compile to wasm in a single step
  • wasm may use memory prepared by JavaScript
  • do something relative compute-intensive
  • do something visible

Mystic issue

Symptom: on some systems, the linker may hang, or produce output file with correct size but full of zeros (that's why build script contains a hexdump as last step).

Solution: update your linker.

More info: https://stackoverflow.com/questions/71573019/cant-compile-to-wasm-on-linux

Install

You need CLANG and CLANG's linker (LLD). Tested on versions 13 and 14.

Debian nightly pacakges: https://apt.llvm.org/

On Windows, you may use Chocolatey package manager to install CLANG: https://chocolatey.org/

Summary

Why WASM?

Writing web app in any language which is not JavaScript is just pure joy.

Try it

The color change and the blur effect is a WASM module, written in C:

http://linkbroker.hu/stuff/howto-wasm-minimal/

More Repositories

1

kolorwheel.js

🌈 Color palette generator JavaScript library
JavaScript
39
star
2

dataflow-editor-concept

Dataflow editor technical concept, using Raphaël.js/SVG
JavaScript
15
star
3

256byte-mzesolvr

256-byte DOS intro: Maze Solver, released at Function2017 - with comments
Assembly
11
star
4

shrinkshot

✂ CLI tool for shrink images by removing empty regions (best use case: screenshot)
C++
10
star
5

savebutton

💾 External save button with CJMCU-Beetle (Ardiono Leonardo) or Digispark ATTiny85, connects with USB
C++
6
star
6

villantott

JavaScript
6
star
7

256byte-xorlissj

256-byte DOS intro: XOR-pattern and Lissajous effect 2-in-1, released at Demobit2017
Assembly
5
star
8

bytebeat-player

▶️ Bytebeat player, using SDL2
C++
5
star
9

549notes

🎹 256-byte PC-DOS intro with MIDI music (co-author: TomCat/Abaddon)
Assembly
4
star
10

posixino

Implementation of Arduino framework and basic libraries for POSIX systems (Linux, BSD, Mac OS X)
C++
3
star
11

maddotz

MadDotz - a tiny particle demo, using Emscripten (SDL2)
HTML
2
star
12

edu-prez

My educational presentations
2
star
13

howto-use-llvm-asm

⚡ How to import a function written in LLVM Assembly into a C application
C++
2
star
14

youda

💾 Youtube Download Automation
Python
2
star
15

kolorwheel.js-website

Website for KolorWheel.js
JavaScript
2
star
16

jquery.resolution

jQuery.Resolution is a simple tool to test different resolutions in a browser. It supports testing high device-pixel-ratio devices (e.g. retina iPhone)
JavaScript
2
star
17

ppro-tester

Pentium Pro instruction set tester for DOS
Assembly
1
star
18

ledclock

Beautiful led clock installation with Arduino and WS2812 rings
C++
1
star
19

jquery.create

Minimal/sample jQuery plugin for creating DOM elements easy way
JavaScript
1
star
20

forcom

Bytebeat Formula Compiler for 16-bit x86 target - UNDER CONSTRUCTION
Python
1
star
21

amperachargingmonitor

🚘 Visual monitoring of EV charging (Opel Ampera / Chevrolet Volt), using a Raspberry Pi with a webcam and an old Android phone
Python
1
star
22

kolorwheel.rs

Color palette generator for Rust, with egui.rs examples
Rust
1
star
23

dump-8086

Simple dump module for 8086 assembly development
Assembly
1
star
24

pymod

How to add native modules for Python: C++ and Rust
C++
1
star
25

xmlgraph

🔧 Renders "autodoc" from XML file
PHP
1
star