[erlang-questions] Drive by mention of new features without explaination
Jarrod Roberson
jarrod@REDACTED
Mon Dec 7 20:47:04 CET 2009
On Mon, Dec 7, 2009 at 2:43 PM, Jarrod Roberson <jarrod@REDACTED> wrote:
>> http://www.erlang.org/doc/reference_manual/code_loading.html#id2278452
>
> thanks Bob for the link, following those instructions I got this far:
>
> // niftest.c
> #include "erl_nif.h"
> static ERL_NIF_TERM hello(ErlNifEnv* env)
> {
> return enif_make_string(env, "Hello world!");
> }
> static ErlNifFunc nif_funcs[] =
> {
> {"hello", 0, hello}
> };
> ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL)
>
> ========================
>
> %% niftest.erl
> -module(niftest).
> -export([hello/0]).
> -on_load(run_me/0).
>
> run_me() ->
> erlang:load_nif("./niftest", 0).
> hello() ->
> "NIF library not loaded".
>
> ========================
I figured it out! I needed to return true/false from the run_me/0 function!
More information about the erlang-questions
mailing list