Open BadCoder1337 opened 1 year ago
so you did get this working with linux?
the ffi function should be reworked soon to expect a buffer, instead of Go freeing the output.
either 1) dll never worked or 2) buffer needs to be implemented
i haven't tested the windows dll because Bun does not yet support windows
They released experimental Bun build for Windows along with 1.0.0
release.
I got working .so
with WSL, but tsc-watch
or any watchers don't support WSL 2 well. RIP DX 🥲
Also, I got this V8 failure while tinkering with an HTTP-only Discord bot in serverless environment. Most likely I should compile r6-dissect
by myself.
#
#
#
# Check failed: result.second.
# Fatal error in , line 0
#
#FailureMessage Object: 0x7efd7f5dc7d0
1: 0xb75ed1 [/function/runtime/nodejs/bin/node]
2: 0x1c08724 V8_Fatal(char const*, ...) [/function/runtime/nodejs/bin/node]
3: 0xfcd741 v8::internal::GlobalBackingStoreRegistry::Register(std::shared_ptr<v8::internal::BackingStore>) [/function/runtime/nodejs/bin/node]
4: 0xd1ef88 v8::ArrayBuffer::GetBackingStore() [/function/runtime/nodejs/bin/node]
5: 0xabdab0 napi_get_typedarray_info [/function/runtime/nodejs/bin/node]
6: 0x7efd94198566 [/function/code/node_modules/ref-napi/prebuilds/linux-x64/node.napi.node]
7: 0x7efd94198dad [/function/code/node_modules/ref-napi/prebuilds/linux-x64/node.napi.node]
8: 0x7efd7f5ea4f3 FFI::WrapPointerImpl(Napi::Env, char*, unsigned long) [/function/code/node_modules/ffi-napi/build/Release/ffi_bindings.node]
9: 0x7efd7f5ecce4 FFI::FFI::InitializeBindings(Napi::Env, Napi::Object) [/function/code/node_modules/ffi-napi/build/Release/ffi_bindings.node]
10: 0x7efd7f5ee3c5 FFI::InitializeBindings(Napi::CallbackInfo const&) [/function/code/node_modules/ffi-napi/build/Release/ffi_bindings.node]
11: 0x7efd7f5ef3fb Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) [/function/code/node_modules/ffi-napi/build/Release/ffi_bindings.node]
12: 0xab44dd [/function/runtime/nodejs/bin/node]
13: 0xd53d8e [/function/runtime/nodejs/bin/node]
14: 0xd551af v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/function/runtime/nodejs/bin/node]
15: 0x15f0bf9 [/function/runtime/nodejs/bin/node]
runtime pid 89: killed by signal 5
node 16.14.1
, Ubuntu 18.04 LTS
, libc 2.27
I compiled valid .dll
with these scripts https://github.com/BadCoder1337/r6-dissect/commit/5ed34c8205798f27a5188032f86541173f2dafe6
It works in the main thread, but doesn't in worker_thread
due to the issue https://github.com/node-ffi-napi/node-ffi-napi/issues/125
I'm going to look into the Windows DLL myself soon and figure out why GitHub Actions is causing problems. Also, I will likely implement a child process / worker implementation for Node on the r6-dissect npm package. Node FFI just looks a little buggy and slow.
Thanks for the scripts, I will consider your changes when I look into the release workflow
Consider koffi FFI library. According their benchmarks it much faster and also works in a worker thread. Working:
new (require("worker_threads").Worker)(`
require("fs").writeFileSync("./test/dump.json",
require("koffi")
.load("./lib/libr6dissect-windows-amd64.dll")
.cdecl("dissect_read", "str", ["str"])
("./test/Match-2023-09-23_12-03-31-55-R07.rec")
)`,
{ eval: true }
)
Not working:
new (require("worker_threads").Worker)(`
require("fs").writeFileSync("./test/dump.json",
require("ffi-napi")
.Library("./lib/libr6dissect-windows-amd64.dll",
{ dissect_read: ["string", ["string"]] }
).dissect_read("./test/Match-2023-09-23_12-03-31-55-R07.rec")
)`,
{ eval: true }
)
Describe the bug Something is wrong with Windows
.dll
. I'm trying to portr6-dissect-bun
to Node.js withnode-ffi-napi
. It gives a V8 failure:node
:16.14.1
ffi-napi
:4.0.3
To Reproduce Steps to reproduce the behavior:
libr6dissect.dll
Expected behavior It should work the same as
libr6dissect.so