Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource creation and dynlibs #2

Open
Qqwy opened this issue May 26, 2022 · 1 comment
Open

Resource creation and dynlibs #2

Qqwy opened this issue May 26, 2022 · 1 comment

Comments

@Qqwy
Copy link
Owner

Qqwy commented May 26, 2022

This library is split in an Elixir part (which contains some Rust NIFs) and a Rust part (which can be included in your own Rust NIFs).

However, it turns out that when we pass a ManualFuture from one of these to the other, an argument error is raised.
Why? My best guess is that the code inside the rustler_elixir_fun Rust crate is active twice: Once statically compiled into your NIF, and once dynamically as part of 'our' NIF.

And when we register a resource, one of these two definitions will win, resulting in badarg errors when passing it to NIF functions of the other.


This is a problem for fill_future.
The only way forward I currently envision is to force people to implement/call this themselves from their own module.

This would mean a change to all Rust and Elixir code, as we'll have to pass which NIF needs to be called afterwards through the whole stack. 😞

I'm still looking for alternatives for the time being.

@filmor
Copy link

filmor commented Jul 11, 2024

This is what dyncall is for, work is started in rusterlium/rustler#635.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants