lwahonen / node-ffi-napi

MIT License
14 stars 13 forks source link

Error : don't know how to set callback function #7

Open jkarthic opened 7 months ago

jkarthic commented 7 months ago

When I try to pass a callback function as an argument, I get the following error.

    at Function.set (/Users/karthick/work/node_modules/.pnpm/@lwahonen+ffi-napi@4.0.12/node_modules/@lwahonen/ffi-napi/lib/function.js:107:11)
    at Object.set (/Users/karthick/work/node_modules/.pnpm/@lwahonen+ref-napi@4.0.8/node_modules/@lwahonen/ref-napi/lib/ref.js:492:10)
    at Object.alloc (/Users/karthick/work/node_modules/.pnpm/@lwahonen+ref-napi@4.0.8/node_modules/@lwahonen/ref-napi/lib/ref.js:526:13)
    at Object.proxy [as asr_start] (/Users/karthick/work/node_modules/.pnpm/@lwahonen+ffi-napi@4.0.12/node_modules/@lwahonen/ffi-napi/lib/_foreign_function.js:50:28)

I found that this error stems from the fact that function.js expects a value of type Buffer or function, whereas the type of value passed is PointerBuffer.