WASM hello-world build (Emscripten)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <emscripten/emscripten.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Exported function: add two numbers
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
// Exported function: print hello message
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void hello() {
|
||||
std::cout << "Hello from C++ WASM!" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user