Compiles C and C++ code alongside Elixir projects for NIFs, CNodes and Ports
open sourceApache-2.0free
Bundlex is a multi-platform tool that compiles C and C++ code along with an Elixir project, for use in NIFs, CNodes and Ports, and gives Elixir modules a convenient way to load and call the compiled code. Natives and their library dependencies are declared in a bundlex.exs project module, and it adds Mix tasks such as generating Doxygen docs for the native code. It supports cross-compilation, which works out of the box with Nerves. The Membrane Framework team maintains it, and Unifex uses it to compile and load native code.
Problems it solves
- compile C code as part of my Elixir project's build
- ship a NIF or CNode with my Elixir library on Linux and macOS
- cross-compile native code for an Elixir Nerves device
Features
- compiles C and C++ natives as part of the Mix build
- NIF, CNode and Port interfaces
- loader macros for calling NIFs from Elixir modules
- statically linked native library dependencies
- cross-compilation, including for Nerves
- Doxygen documentation for native code
Limitations
- Windows support is experimental and unstable; it's tested on Linux, macOS and FreeBSD1
