summaryrefslogtreecommitdiff
path: root/test/wasm_backend/globals_only.cpp
blob: 9a2f1bcc8ceef47dd3881ae12b5cfdb076bdc4d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <emscripten.h>

char c = 10;
short s = 20;
int i = 55;

void print(int v) {
  int *x = (int*)8;
  *x = v;
  EM_ASM({
    Module.print("print: " + HEAP32[8>>2]);
  });
}

int main() {
  print(1);
  print(c);
  print(s);
  print(i);
}