[erlang-questions] NIFS
zv
zv@REDACTED
Sun Feb 5 09:01:39 CET 2017
I'm not familiar with ~nifpp~ in particular, but if you are receiving an error like
> undefined symbol: enif_make_atom
There are underlying issues beyond symbol mangling.
I assume you are including erl_nif.h, directly or otherwise. As far as the mangling is concerned, you haven't made it clear if you are using objdump to extract the correct symbol name or if you are relying on the compiler, although Stanislaw has already mentioned the issue so you have a thread to follow.
If you are getting an 'undefined symbol' on function call, you are dynamically linking your library, which means you need to make sure that your library is on the linker path during runtime as that's how the dynamic library loader will find it (which happens when you load the nif in Erlang, it spiders out to the libraries that library needs until it can resolve all the required symbols).
An alternative approach would be to make your my.so a static library my.a and then link your nif against that which removes some of these issues in finding libraries.
You also might want to just consider an "extern C" linkage declaration, totally bypassing any mangling or other C++ symbol decoration idiosyncrasies.
- zephyr
More information about the erlang-questions
mailing list