Don't export the load function, it gets called automatically
This commit is contained in:
1
geef
1
geef
@@ -3,7 +3,6 @@
|
||||
%%! debug verbose -noshell -pa ebin
|
||||
|
||||
main([Command|_Args]) ->
|
||||
geef:start(),
|
||||
case Command of
|
||||
"h2r" ->
|
||||
[Object|_Rest] = _Args,
|
||||
|
||||
24
src/geef.erl
24
src/geef.erl
@@ -1,16 +1,6 @@
|
||||
-module(geef).
|
||||
-export([start/0, hex_to_raw/1, object_exists/2, repository/1, repository_path/1]).
|
||||
-on_load(start/0).
|
||||
|
||||
start() ->
|
||||
case code:priv_dir(geef) of
|
||||
{error, bad_name} ->
|
||||
SoName = filename:join("priv", geef);
|
||||
Dir ->
|
||||
SoName = filename:join(Dir, geef)
|
||||
end,
|
||||
io:format("Hey There: ~s~n", [SoName]),
|
||||
erlang:load_nif(SoName, 0).
|
||||
-export([hex_to_raw/1, object_exists/2, repository/1, repository_path/1]).
|
||||
-on_load(load_enif/0).
|
||||
|
||||
hex_to_raw(_Val) ->
|
||||
nif_error(?LINE).
|
||||
@@ -33,3 +23,13 @@ repository(Path) ->
|
||||
|
||||
nif_error(Line) ->
|
||||
exit({nif_not_loaded,module,?MODULE,line,Line}).
|
||||
|
||||
load_enif() ->
|
||||
case code:priv_dir(geef) of
|
||||
{error, bad_name} ->
|
||||
SoName = filename:join("priv", geef);
|
||||
Dir ->
|
||||
SoName = filename:join(Dir, geef)
|
||||
end,
|
||||
io:format("Hey There: ~s~n", [SoName]),
|
||||
erlang:load_nif(SoName, 0).
|
||||
|
||||
Reference in New Issue
Block a user