You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the C library I use offers the possibility to register an arbitrary void pointer as "userdata" with an opaque structure (lib_set_userdata()). If an event occurs, a generic callback function is called with the opaque structure as argument and I can retrieve the userdata from the structure using another function (lib_get_userdata()).
I currently fail to come up with a solution to pass an arbitrary JS object as void pointer and convert it back to the same object in the callback function. Is this somehow supported with Koffi? I guess, I could maintain my own list of userdata objects in a list and store the index in the void pointer and use the index later to convert it back to the object.
I saw that I could bind a callback function to an object with koffi.register() but in my case, the callback is generic and I need to reconstruct the JS object from a void pointer.
Thank you!
The text was updated successfully, but these errors were encountered:
Hello,
the C library I use offers the possibility to register an arbitrary void pointer as "userdata" with an opaque structure (
lib_set_userdata()
). If an event occurs, a generic callback function is called with the opaque structure as argument and I can retrieve the userdata from the structure using another function (lib_get_userdata()
).I currently fail to come up with a solution to pass an arbitrary JS object as void pointer and convert it back to the same object in the callback function. Is this somehow supported with Koffi? I guess, I could maintain my own list of userdata objects in a list and store the index in the void pointer and use the index later to convert it back to the object.
I saw that I could bind a callback function to an object with
koffi.register()
but in my case, the callback is generic and I need to reconstruct the JS object from a void pointer.Thank you!
The text was updated successfully, but these errors were encountered: