FFI callback with multiple parameters
Hey could someone please help me with this interface definition:
I would like to know on how to properly define my FFI interface for that kind of C++ function. I want to understand how this works correctly, because I think my current approach is completely wrong π
I want to transmit kind of an βobjectβ from C++ to TypeScript. And I read somewhere that this is the preferred method, using a callback function.
Thanks π
9 Replies
Right, you'll need to use the
Deno.UnsafeCallback API to create the callbacksππ» will try. Thanks
Did you succeed? π
I think so, yes. I currently donβt have a dll on my hand to test it π
but I think this should work: https://github.com/Serial-IO/serial/blob/main/src/ffi/get_devices.ts it still needs to refined, cleared up und refactored but I think this should work
GitHub
serial/src/ffi/get_devices.ts at main Β· Serial-IO/serial
Core library for the serial communication. Contribute to Serial-IO/serial development by creating an account on GitHub.
@AapoAlas do you know if this works?
https://discord.com/channels/684898665143206084/1438820103230849024
No idea unfortunately. I haven't really played around with JSR. You might be able to test with eg. a raw GitHub URL without publishing to JSR though.
Okay. Problem is Deno.dlopen() supports a local path as a string or an URL object. Question is if the URL object needs to be an actual URL like https:// or if it also supports file:// URLs
And if Deno is able to resolve these
When installed as a JSR package
No idea.
I will test that