Current section
Files
Jump to
Current section
Files
src/ucl.erl
-module(ucl).
-export([to_json/1]).
-on_load(init/0).
-define(APPNAME, ucl).
-define(LIBNAME, ucl_nif).
to_json(_) ->
not_loaded(?LINE).
init() ->
SoName = case code:priv_dir(?APPNAME) of
{error, bad_name} ->
case filelib:is_dir(filename:join(["..", priv])) of
true ->
filename:join(["..", priv, ?LIBNAME]);
_ ->
filename:join([priv, ?LIBNAME])
end;
Dir ->
filename:join(Dir, ?LIBNAME)
end,
erlang:load_nif(SoName, 0).
not_loaded(Line) ->
exit({not_loaded, [{module, ?MODULE}, {line, Line}]}).