File: calls.cpp

package info (click to toggle)
binaryen 68-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 34,900 kB
  • sloc: cpp: 57,351; ansic: 3,562; python: 2,898; sh: 700; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 414 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <emscripten.h>

extern "C" {

int inner(int x) {
  return x*x + 2;
}

int EMSCRIPTEN_KEEPALIVE simple(int x) {
  return inner(x);
}

int EMSCRIPTEN_KEEPALIVE fibo(int x) {
  if (x == 0 || x == 1) return 1;
  return fibo(x-1) + fibo(x-2);
}

int EMSCRIPTEN_KEEPALIVE run_script() {
  emscripten_run_script("Module.print('hello from called script')");
  return emscripten_run_script_int("1+2+3+4-1");
}

}