Current section
Files
Jump to
Current section
Files
templates/nif.ex.eex
defmodule <%= mod %> do
# When your move/rename this file (and you should) make sure
# you also change the ERL_NIF_INIT call at the bottom of
# c_src/#{name}_nif.c
@on_load :init
def init do
:erlang.load_nif("./priv/lib/lib_<%= name %>", 0)
end
# A simple wrapper around the NIF call
def hello do
_hello
end
# This function will not be overwritten if the nif fails to load
def _hello do
"NIF library not loaded"
end
end