WASM hello-world build (Emscripten)

This commit is contained in:
saqib mir
2026-05-21 12:51:06 +05:30
parent 81297f7ea5
commit 86ac50cb42
3 changed files with 4650 additions and 0 deletions
+18
View File
@@ -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;
}
}