emscriptenでJavaScriptから関数を呼ぶ

http://faantasticcoder.blogspot.jp/2013/05/calling-c-function-from-javascript-in.html

hello.cpp

#include <stdio.h>
extern "C" {

int hello(void) {
  printf ("hello\n"); 
  return 0;
}

}// extern c

hello.html生成

emcc -s EXPORTED_FUNCTIONS="['_hello']" hello.cpp -o hello.html
open hello.html

コンソール上で呼び出し

Module.ccall('hello')
>hello.html:1233 hello