Tag: erlang nif

在Erlang C NIF中分配内存

为什么会使用 void *enif_alloc_resource(ErlNifResourceType* type, unsigned size) 而不是 void *enif_alloc(size_t size) 当试图从Erlang C NIF分配内存时? 参考文献没有详细说明原因。 http://www.erlang.org/doc/man/erl_nif.html#enif_alloc

Erlang NIF测试 – OS X Lion

我正在尝试在Mac OS X Lion上从Erlang( http://www.erlang.org/doc/man/erl_nif.html )编译NIF测试。 我无法编译。 我错过了编译器标志吗? 这是我得到的错误: Computer:~ me $ gcc -fPIC -shared -o niftest.so niftest.c -I /usr/local/Cellar/erlang/R14B02/lib/erlang/usr/include/ Undefined symbols for architecture x86_64: “_enif_make_string”, referenced from: _hello in ccXfh0oG.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status 我也用-m32尝试了这个,但它说没有i386架构。 谢谢!