Skip to content

Commit

Permalink
Fix broken nif load
Browse files Browse the repository at this point in the history
  • Loading branch information
farhadi committed Jul 3, 2023
1 parent f586e49 commit ea9d4a6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion native/xxh3/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/xxh3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xxh3"
version = "0.3.4"
version = "0.3.5"
authors = []
edition = "2018"

Expand Down
14 changes: 14 additions & 0 deletions src/cargo.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-cargo_header_version(1).
-ifndef(CARGO_LOAD_APP).
-define(CARGO_LOAD_APP, xxh3).
-endif.
-ifndef(CARGO_HRL).
-define(CARGO_HRL, 1).
-define(load_nif_from_crate(__CRATE, __INIT),
(fun() ->
__APP = ?CARGO_LOAD_APP,
__PATH = filename:join([code:priv_dir(__APP), "crates", __CRATE, __CRATE]),
erlang:load_nif(__PATH, __INIT)
end)()
).
-endif.
14 changes: 0 additions & 14 deletions src/crates.hrl

This file was deleted.

2 changes: 1 addition & 1 deletion src/xxh3.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, xxh3, [
{description, "NIF bindings for XXH3 hash functions implemented in Rust"},
{vsn, "0.3.4"},
{vsn, "0.3.5"},
{registered, []},
{applications, [
kernel,
Expand Down
4 changes: 2 additions & 2 deletions src/xxh3.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
hash128_with_secret/2
]).

-include("crates.hrl").
-include("cargo.hrl").

-opaque xxh3_ref() :: reference().

Expand All @@ -42,7 +42,7 @@
-on_load(init/0).

init() ->
?load_nif_from_crate(xxh3, ?crate_xxh3, 0).
?load_nif_from_crate(xxh3, 0).

%% @doc Creates a new 64-bit hasher with default secret.
%%
Expand Down

0 comments on commit ea9d4a6

Please sign in to comment.