I am trying to send an arraybuffer of javascript to c using emscripten
Here my c code
#include <stdio.h>
void testFunc(uint8_t* data, int size)
{
int i = 0;
printf("data: %d
", data[i]);
}
and I made test.js using emcc
Here my Javascript code
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script type="text/javascript" src="test.js"></script>
<script>
window.onload = function() {
setTimeout(() => {
const testcase = Module.cwrap('testFunc', null, ['number', 'number']);
console.log(testcase(???));
}, 2000);
}
</script>
</body>
</html>
I don't know what parameters are going to be in the cwrap function here
Thank you for your help
question from:
https://stackoverflow.com/questions/65559519/how-do-i-send-array-values-to-javascript-c-using-emscripten 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…