Giter Site home page Giter Site logo

webassembly's Introduction

WebAssembly

Harnessing the Speed of C/C++ world in Web

Requirements

git clone git clone https://github.com/juj/emsdk.git

cd emsdk

./emsdk install latest

./emsdk activate latest

$ source ./emsdk_env.sh --build=Release

Write a Sample C++ or C Application

#include <iostream>

long gcd(long a, long b){
      if(a == 0){
          return b;
      }else if(b == 0){
          return a;
      }else{
          return gcd(b, a % b);
      }
  }
int main(int argc, const char * argv[]) {
    std::cout << gcd(190, 76);
}

Compilation

emcc main.cpp --emrun -s WASM=1 -o test.html

Output

Cooy and run test.html on a web server

References

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

0Gohman,%20Wagner,%20Zakai,%20Bastien,%20Holman%20-%20Bringing%20the%20Web%20up%20to%20Speed%20with%20WebAssembly.pdf

https://kripken.github.io/emscripten-site/docs/introducing_emscripten/index.html

http://webassembly.org/getting-started/developers-guide/

webassembly's People

Contributors

riaz avatar

Watchers

James Cloos avatar  avatar  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.