문제

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,

도움이 되었습니까?

해결책

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'])
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top