I have an issue in dereferencing a buffer using ffi and ref in Node.js. I created javascript wrapper using ffi to call dll functions. What I am doing below is passing a different types of pointer to pointer to dll, allocate memory in dll, and assign values to these memory. Then read these values back in javascript.
result1 and result4 are OK but result2 and result3 are wrong. It seems that somethings is wrong with dereferencing the buffer with type 'float' and 'int'. However, it works for 'char**'.
I have an issue in dereferencing a buffer using ffi and ref in Node.js. I created javascript wrapper using ffi to call dll functions. What I am doing below is passing a different types of pointer to pointer to dll, allocate memory in dll, and assign values to these memory. Then read these values back in javascript.
Here is my C++ functions:
Here is my javacript application:
And here is my console output:
result1 and result4 are OK but result2 and result3 are wrong. It seems that somethings is wrong with dereferencing the buffer with type 'float' and 'int'. However, it works for 'char**'.
Could you help me with it? Thank you!