Closed thewh1teagle closed 2 months ago
on_ready function has been called successfully with logs , you have not called the closure callback in your code
#[no_mangle]
pub extern "C" fn on_ready(callback: Option<extern "C" fn()>) {
println!("xx");
// Store the callback function in the global variable
*READY_CALLBACK.lock().unwrap() = callback;
}
on_ready function has been called successfully with logs , you have not called the closure callback in your code
#[no_mangle] pub extern "C" fn on_ready(callback: Option<extern "C" fn()>) { println!("xx"); // Store the callback function in the global variable *READY_CALLBACK.lock().unwrap() = callback; }
The on ready register on ready callback. Later I call it here:
https://github.com/thewh1teagle/tauric/blob/main/c-api/src/lib.rs#L105-L110
In the nodejs callback it should print ready
. But although I can see that rust call it, nodejs doesn't print ready
https://github.com/tauri-apps/tauri/issues/3172
It looks like tauri.run
method blocks the main thread cause callback
cannot be executed
Current ffi-rs version
Print current Node.js info with the following code
$ cat node_modules/ffi-rs/package.json
$ ls node_modules/@yuuang
ls node_modules/@yuuang ffi-rs-darwin-arm64
Current Node.js arch
Print current Node.js info with the following code
node -v
v20.15.1 ➜ node git:(main) bun -v
1.1.18
$ node -e "console.log(process.arch, process.platform)"
Descibe your problem in detail
I created bindings using ffi-rs to tauric I have a function called
on_ready
that accept function pointer and it's being called afterrun
is called and ready. I register it in bindings/node/index.ts#L25. In nodejs it desn't being called. In bun.js when register it I get error:You can see that with python bindings it works: bindings/python/main.py
What's your expect result
The callback that passed should being called few moments after run is called.
The reproduction repo address
https://github.com/thewh1teagle/tauric