Calling other languages from Elixir

How calling other languages from Elixir works ?
Does elixir/erlang interface badly with other languages (C++/ Go / C / Java … ) ?
Does it affect the the ability to use OTP’s capabilities ?

Interfacing works very well and you have plenty of options to do so.

Its best to read the Erlang guide to InterOp.

Its different from the FFI of many other languages where you often can call C-functions more or less directly…

2 Likes
4 Likes

Here is a good article on this for Elixir + Python: https://hackernoon.com/mixing-python-with-elixir-7a2b7ac6696

3 Likes

There’s too a great bridge to Rust that doesn’t crash the BEAM in case of failure: https://github.com/hansihe/rustler

3 Likes

Cnode is the best solution, that’s how I work with OpenCV (C++) from Elixir. There’s a certain amount of boilerplate code you have to write on both sides, but after that it’s very flexible, you can do anything you want without worrying about crashing Elixir side.

1 Like

Interesting! Do you have an example regarding the boilerplate? Thanks for the source!

http://erlang.org/doc/tutorial/cnode.html

2 Likes

Thanks @cmkarlsson !!

Is anyone using Apache Thrift (https://thrift.apache.org/) for their cross-language RPC? And if so, do you like it?