Permalink
Browse files

Dynamically create path to NIF relative to module.

Assumes the lib is in the priv directory.
  • Loading branch information...
1 parent 859492c commit 5d8600faa567c065cf3b161ce98dfe71602bf07b @msantos committed Mar 9, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/procket.erl
View
@@ -37,11 +37,18 @@
-on_load(on_load/0).
+
init() ->
on_load().
on_load() ->
- ok = erlang:load_nif("priv/procket", []).
+ Lib = filename:join([
+ filename:dirname(code:which(?MODULE)),
+ "..",
+ "priv",
+ ?MODULE
+ ]),
+ erlang:load_nif(Lib, []).
open(_) ->
erlang:error(not_implemented).

0 comments on commit 5d8600f

Please sign in to comment.