I try to implement a very simple example to return values from an array. My example seems simple but I couldn't understand why it is not working:
This my code in C++
static int results[20];
extern "C" {
void setValue(int index, int value {
results[index] = value;
}
int getValue (int index) {
return results[index];
}
};
My code in .html:
Module.ccall('setValue',null,['number','number'],1,1);
var val = Module.ccall('getValue','number',['number'],1);
My command for compiling:
emcc --bind -o face_quick_example.js face_quick_example.cpp -s EXPORTED_FUNCTIONS="['_setValue','_getValue']"
I checked the tutorial and some stackoverflow answers, but I couldn't it do working