How to use compiled erlang modules in an elixir project?

42 Views Asked by At

I have an erlang application that has been compiled already so I do not have access to the source code. The folder structure looks like this

base_app
  lib
    package_1
      ebin
        - package_1.app
        - package_1.beam
      src
        - package_1.app.src
    package_2
      ebin
        - package_2.app
        - package_2.beam
      src
        - package_1.app.src

I want to be able to call functions from those packages in my elixir code, for example

:package_1.do_this()

I have added those folders under the lib folder of my mix project, but that doesn't work for me. I'm unsure how else to go about this.

1

There are 1 best solutions below

0
Aparigraha On

When Elixir code is compiled, the generated *.beam files will live inside _build/test|dev/*/ebin/, its organized based on environment.

Hence in your case placing the compiled erlang code inside lib will not likely work. I haven't tried it myself, but try putting the compiled erlang folder somewhere in the _build(remember about environment) and then do some adjustments. I am not fully sure if this will work directly as mix is also involved.

Hope that helps!