If you mean specifically on the BEAM (ignoring JS runtimes), the two options are ports and NIFs, both of which unfortunately have their drawbacks.
The Erlang docs on this are here: https://www.erlang.org/doc/system/overview.html
The Erlang docs on this are here: https://www.erlang.org/doc/system/overview.html