I want to integrate the aerospike erlang client to the erlang environment as a global module in Fedora 21. I achieve to make the client nif and module but I have to always copy the files in every project. Now I want to use the aerospike module like the erlang or os modules. How can I make this?
I had the same issue when experimenting with the Aerospike binding. The problem is that the .so
file is assumed to be in the current working directory. I made a small change to aerospike.erl
so it's located correctly independent of the path.
Replace
ok = erlang:load_nif("./aerospike_nif", 0).
in init()
with
EbinDir = filename:dirname(code:which(?MODULE)),
SoFile = filename:join(EbinDir,"aerospike_nif"),
erlang:load_nif(SoFile, 0).
When starting erl
, add the path to the directory containing the Aerospike beam files and .so
: erl -pa path_to_aerospike/erlang/