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

Add unsafe dyncall support #635

Merged
merged 3 commits into from
Aug 5, 2024
Merged

Add unsafe dyncall support #635

merged 3 commits into from
Aug 5, 2024

Conversation

filmor
Copy link
Member

@filmor filmor commented Jul 11, 2024

This adds support for dynamic resource calls (https://www.erlang.org/doc/apps/erts/erl_nif#enif_dynamic_resource_call). The feature is inherently unsafe (exchanging pointers to mutable data between different dynamic libraries), though we might be able to eventually provide a stable API on top of it.

Changes to other parts:

  • Exposes all of rustler_sys under rustler::sys s.t. it doesn't have to be explicitly referenced
  • Adds helper function to compile tests and nif stubs only for particular NIF versions
  • Ensures that RustlerTest can be loaded at startup

@filmor
Copy link
Member Author

filmor commented Aug 5, 2024

For reference, the error on Windows is
image

Oddly enough, this is during compilation (maybe because Elixir loads compiled artifacts?), not at runtime. I'll have to investigate a bit more.

/EDIT: The crash happens during the on-load callback, maybe there is something wrong with our spec of init_resource?

@filmor filmor force-pushed the dyncall branch 4 times, most recently from 2954362 to ddda5fa Compare August 5, 2024 20:19
@filmor
Copy link
Member Author

filmor commented Aug 5, 2024

The issue described above is fixed with #643

@filmor filmor changed the base branch from master to fix-windows-api-funcs August 5, 2024 20:20
@filmor filmor mentioned this pull request Aug 5, 2024
Base automatically changed from fix-windows-api-funcs to master August 5, 2024 20:29
@filmor filmor merged commit 73357df into master Aug 5, 2024
7 checks passed
@filmor filmor deleted the dyncall branch August 5, 2024 20:37
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

Successfully merging this pull request may close these issues.

1 participant