Skip to content
Browse files

Modified the erlang module to load `emtn_drv` instead of `emtn`; euni…

…t test passes.
  • Loading branch information...
1 parent bbf35f6 commit 2e7eed36ebbff39681a85860fc5fdcedda58fe1b @lenards lenards committed Jun 25, 2013
Showing with 5 additions and 2 deletions.
  1. 0 c_src/{emtn_nif.c → emtn.c}
  2. +3 −1 rebar.config
  3. +2 −1 src/emtn.erl
View
0 c_src/emtn_nif.c → c_src/emtn.c
File renamed without changes.
View
4 rebar.config
@@ -1,10 +1,12 @@
-{port_specs, [{"priv/emtn_drv.so",["c_src/emtn_nif.c"]}]}.
+{erl_opts, [debug_info, warnings_as_errors]}.
{port_env, [{"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -Wextra -I c_src/mutton"},
{"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/mutton/build/lib/libmutton.a"},
%% Make sure to link -lstdc++ on Linux, FreeBSD, or Solaris
{"(linux|freebsd|solaris)", "LDFLAGS", "$LDFLAGS -lstdc++"}]}.
+{port_specs, [{"priv/emtn.so",["c_src/*.c"]}]}.
+
{pre_hooks, [{compile, "c_src/build_deps.sh"}]}.
{post_hooks, [{clean, "c_src/build_deps.sh clean"}]}.
View
3 src/emtn.erl
@@ -5,6 +5,7 @@
-on_load(init/0).
+-define(SHAREDLIB, "emtn_drv").
-define(nif_stub, nif_stub_error(?LINE)).
nif_stub_error(Line) ->
erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).
@@ -22,7 +23,7 @@ init() ->
Path ->
Path
end,
- erlang:load_nif(filename:join(PrivDir, ?MODULE), 0).
+ erlang:load_nif(filename:join(PrivDir, ?SHAREDLIB), 0).
new() ->
?nif_stub.

0 comments on commit 2e7eed3

Please sign in to comment.
Something went wrong with that request. Please try again.