[erlang-questions] undefined functions when using custom NIF library

Sverker Eriksson sverker@REDACTED
Thu Sep 23 17:14:47 CEST 2010

You don't need liberts or any other library (unless you use them yourself).
All enif_* symbols are defined within the emulator executable binary 
(beam or beam.smp) and should be resolved when your NIF library is loaded.

I guess you are not building your library correctly. This usually works:

gcc -Wall -fPIC -shared -o niftest.so niftest.c -I $ERL_ROOT/usr/include/

/Sverker, Erlang/OTP

Stephen Cuzzort wrote:
> I'm trying to create a custom NIF library to handle some number crunching,
> but I'm having trouble when I load the nif.  I call
> erlang:load_nif("./nifmath", 0), which fails - it says enif_get_string is
> undefined.  I'm using gcc with Ubuntu 10.4, and have added liberts to the
> library list and included the erlang include directory.
> Steve

More information about the erlang-questions mailing list