[erlang-questions] BIF or NIF for extending Erlang on OS which can't dynamic link

Peer Stritzinger peerst@REDACTED
Thu May 3 23:16:51 CEST 2012


I'm currently porting Erlang to RTEMS a small embedded OS that can't
dynamic link.

If I want to extend Erlang with functionality written in C (e.g. for
accessing hardware or RTEMS features) I always have to statically link
this code to the Erlang + RTEMS image -- the OS is just a executive
which is linked as a lib to Erlang which together boots directly on
the hardware.

If I want to use NIFs or linked drivers there is always some dynamic
linking going on which fails for me since there is no dlopen etc.
functionality in the basic RTEMS system.

So I planned to fake the dynamic linking either on the dlopen/dlsym
level or at the erts_sys_ddll_* level.

The other possibility would be to add the functions to be written in C as BIFs

Currently I don't know how to add my own BIFs, so I can't decide if
this is the way to go or rather stick with faking dynamic linking.

What do you think is best?

Peer Stritzinger

More information about the erlang-questions mailing list