I would recommend creating a port driver.
The NIF object is a way to add new built-in functions to the language and speed up work that will be too slow to implement in pure Erlang. In any case, NIFs are considered experimental, so the interface may change dramatically in future releases.
Writing a port driver means an implementation of C (or C ++) that behaves like an entire erlang process. This provides more flexibility since you can communicate with other processes when converting a document (callbacks ...), etc.
It doesn't even have to be a driver. If you donβt go through a lot of data between your port program and other Erlang code, you might consider writing a simple port (easier).
source share