[erlang-questions] why can not call erl_init() in drivers

Per Hedeland per@REDACTED
Thu Jul 2 16:29:53 CEST 2009

caox <caox@REDACTED> wrote:
>   I found the erl_interface lib can not be used when I was working on 
>some c-drivers for erlang, since there is no response when calling 

This is probably because there is an erl_init() function in the emulator
itself (in erts/emulator/beam/erl_init.c) that does "something
completely different", and that's the one you end up calling. I happened
to notice that as I wanted to use erl_interface in a driver a while
back, never actually tried calling erl_init() though.:-)

In my case it never was a problem, because in the driver I actually
dynamically loaded a library (i.e. via dlopen()) that was built from
erl_interface and some other stuff, and so while the driver does call
the erl_init() in erl_interface, it does it via the pointer returned by
dlsym(), not a direct call - hence no collision possible (for erl_init()
or any other function that happens to have the same name as one in the

There are probably other ways to avoid the issue, e.g. you could have
the 3 lines of code that erl_init() consist of in your driver instead -
or maybe it would work if you link your driver statically with


More information about the erlang-questions mailing list