[erlang-questions] NIFS

Mikael Pettersson mikpelinux@REDACTED
Sun Feb 5 11:11:57 CET 2017


Karlo Kuna writes:
 > also
 > ldd -r my.so
 > gives:
 > undefined symbol: _ZNSt8ios_base4InitD1Ev
 > undefined symbol: enif_make_atom
 > undefined symbol: _ZNSt8ios_base4InitC1Ev

The enif_make_atom one is expected; it will be satisfied by the VM itself
when you load the .so.

The others indicate that the dynamic linker is unable to find all external
shared libraries you depend on, in particular ones that should have come
from the system's C++ / libstdc++ installation.

Something's fishy with your system or your build/deploy procedures.

 > 
 > 
 > 
 > On Sun, Feb 5, 2017 at 6:48 AM, Karlo Kuna <kuna.prime@REDACTED> wrote:
 > 
 > > now i'm getting:
 > > undefined symbol: _ZNSt8ios_base4InitD1Ev
 > >
 > >
 > >
 > > On Sat, Feb 4, 2017 at 11:45 PM, Stanislaw Klekot <erlang.org@REDACTED>
 > > wrote:
 > >
 > >> On Sat, Feb 04, 2017 at 11:25:33PM +0100, Karlo Kuna wrote:
 > >> > i am using c++ to implement nif module
 > >> > and i am using nifpp (https://github.com/goertzenator/nifpp)
 > >> >
 > >> > now i can compile my project but on function call i get:
 > >> >
 > >> > Failed to load NIF library: my.so undefined symbol:
 > >> > _ZTVN10__cxxabiv117__class_type_infoE
 > >> >
 > >> > can someone give me a hint what is this error?  is it linkage, or bad
 > >> call,
 > >> > or something else
 > >> > and how go about solving it?
 > >>
 > >> It's because of name mangling by C++ compiler (necessary thing for
 > >> overloaded functions to work). It's a totally expected problem when
 > >> you're writing in C++ a library that needs to be used by system written
 > >> in C. You need to disable name mangling for your NIF function.
 > >>
 > >> --
 > >> Stanislaw Klekot
 > >>
 > >
 > >
 > 
 > ----------------------------------------------------------------------
 > _______________________________________________
 > erlang-questions mailing list
 > erlang-questions@REDACTED
 > http://erlang.org/mailman/listinfo/erlang-questions

-- 



More information about the erlang-questions mailing list