Failed to call ffi

#1

The code is as follows:
let calloc = ffi(‘void *calloc(int, int)’);
let ptr = calloc(100, 1);
let dw = DataView.create(ptr, 0, 100);
dw.setUint8(2, 0xff);

Code from: https://github.com/cesanta/mjs/blob/master/mjs/lib/api_dataview.js

Output:
bad ffi signature: “void *calloc(int, int)”: dlsym(‘calloc’) failed.

Please help us out with this problem.thanks

#2

I think it should be

ffi(‘void* calloc(int, int)’);