Question

Module.cwrap(funcname, return, params) is Module.cwrap('square', 'number', ['number']) if the C++ function looks like this: int square(int);

But what if my C++ function look like this? int fnc(int, int[]);

Thanks in advance,

Was it helpful?

Solution

Well first of while you can compile with C++, you have to export the function via C conventions (to prevent name mangling).

And then (as you probably know) int[] is nothing else than int* for C/C++. So it again is a number:

Module.cwrap('fnc', ['number', 'number'], ['number'])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top