I have some C functions that I need to call frequently from nodeJS (less than 1 second time intervals). The C function takes in an argument and returns a value, which might be an int or an array.
It can be as simple as below:
int main() {
int x = 2;
return x;
}
And I need to get the value x in nodeJS and be able to do console.log(x)
I tried using node-ffi, but I read from the internet that it has a large overhead and is thus inefficient for frequent function calls.
I also considered writing addons but it seems very troublesome (with unfamiliar V8, C++ code and all that...)
And there is not much resources regarding integration between nodeJS and C (they are mostly nodeJS with C++)
Could somebody help shed some light on this? Thanks.