Closed tinyAdapter closed 5 years ago
Which your platform and 32/64?
win10 x64 build 17763 (1809) with node.js v8.15.0-x86
UPDATE: upgrade node to v10.15.1, back to package ffi and ref solve the problem.
Conclusion (under my test):
node version | ffi / ffi-napi | work |
---|---|---|
8 | ffi | No |
8 | ffi-napi | No |
10 | ffi | Yes |
10 | ffi-napi | No |
Cannot figure out whether it's bug of node or ffi-napi, maybe both. 🤔
I found ffi-napi not stable yet. https://github.com/node-ffi-napi/node-ffi-napi/issues/33
ffi should work fine under nodejs v8.x.
pls try version v33 with updated version of ffi
npm i win32-api@^3.7.0
Test for Node.js v8, v10, v11: https://ci.appveyor.com/project/waitingsong/node-win32-api/builds/22538193
@tinyAdapter It works with 1k loops. demo: https://github.com/waitingsong/node-win32-api/blob/v3/test/90_loop_callback.test.ts
I've switched to node v10 and cannot test it right now. But seems it worked. I'm closing this issue. If someone still got the similar problem, comment here.
After WndProc callback being called about 200 times, the whole process crashed without any error output.
The last several callback messages seems no exception:
BTW, this is not the first time I've faced such a problem, any win32 APIs with callback have this weird behavior after some calls.
I've tried holding the reference of callback function with
process.on('exit', function() { WndProc; })
, but nothing worked at all.