Code Monkey home page Code Monkey logo

blog's Introduction

学习笔记

blog's People

Contributors

zmiaozzz avatar

blog's Issues

WebAssembly

1. 什么是WebAssembly?

MDN doc:https://developer.mozilla.org/en-US/docs/WebAssembly

2. 怎么使用?

安装编译工具Emscripten:

git clone https://github.com/juj/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh --build=Release

接下来执行以下命令可将hello.c编译成html:

emcc hello.c -s WASM=1 -o hello.html

Emscripten本来是将C/C++文件编译成asm.js文件的,通过加上-s WASM=1标志可编译成wasm文件。通过上述命令编译出的文件包括hello.html、hello.js、hello.wasm,如果想要只编译生成wasm文件,需要参考WebAssembly Standalone
WebAssembly Standalone Demo:https://gist.github.com/kripken/59c67556dc03bb6d57052fedef1e61ab

两个工具

  • WABT

    支持二进制WebAssembly格式 与 程序员可读的文本格式(S-expression格式)之间的转换

    • wasm2wast Tool:将WebAssembly二进制格式转换成S-expression;

    • wast2wasm Tool

    • wasm-interp Tool:让开发者可以通过命令行运行WebAssembly二进制

  • Binaryen

    Compiler infrastructure and toolchain library for WebAssembly

    支持asm.js与WebAssembly之间的相互转换;LLVM;RUST等

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.