Search code examples
elixirexrm

Including wxwidgets in exrm build


How can I add the wxwidgets library to my Windows exrm build? Currently, when I run my exrm-built application on Windows or try to use :wx.new(), I receive a message:

** (UndefinedFunctionError) function :wx.new/0 is undefined (module :wx is not available)


Solution

  • I managed to solve my problem by adding a relx.config file to the rel directory in my project. Getting the syntax right was a little challenging, but I noticed that mix release created a temporary rel\.files directory while it was running. In that directory is a generated version of relx.config that you can use for reference. Since the mix task takes a while to run, there is time to open that file and peek at its contents.

    With an app named foo, the contents of the relx.config file was just one line:

    {release,{foo,"0.0.1"},[{foo,"0.0.1"},elixir,iex,sasl,wx]}.
    

    The only part I added was the ",wx".

    I ran mix release --prod once again and then extracted the rel\foo\releases\0.0.1\foo.tar.gz file into a test directory. From that test directory, .\bin\foo console ran my application with all the GUI working as expected.