WebAssembly com C/C++ (Emscripten)

Instalação

Instale o Git

Instale o Python

Execute esses comandos no Terminal

# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

Após o Download do Repositório, execute esses comandos no Terminal

# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

Configurando o PATH do MSDOS no Emscripten

Compilando o Código de C/C++ para WebAsseembly

Código Fonte

Arquivo: hello_world.c

/*
* Copyright 2011 The Emscripten Authors. All rights reserved.
* Emscripten is available under two separate licenses, the MIT license and the
* University of Illinois/NCSA Open Source License. Both these licenses can be
* found in the LICENSE file.
*/

#include <stdio.h>

int main() {
printf("hello, world!\n");
return 0;
}

Comando:
./emcc hello_world.c -o hello.html

Resultado:

Observação: Tem que rodar no Servidor

[Clique Aqui]