Coder Social home page Coder Social logo

mpw / howto-wasm-minimal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ern0/howto-wasm-minimal

0.0 1.0 0.0 67 KB

How to create minimal wasm module

License: MIT License

Shell 4.72% C++ 43.31% HTML 9.22% JavaScript 39.03% Batchfile 3.72%

howto-wasm-minimal's Introduction

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:

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

howto-wasm-minimal's People

Contributors

ern0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.