I'm building a system that needs to use a previously built OTP application (lets call it X). If I want to build a new OTP application / module, how can I use the application that already exists from a module, for instance?
I assumed I could call start
, since it follows the application
behaviour, and so I built a minimalistic application Y that has the following code:
y.erl:
-module(y).
-behaviour(application).
start(_StartType, _StartArgs) ->
io:format("going to call x_app~n"),
{ok, _} = x_app:start([]),
io:format("called x_app~n"),
y:start_link().
stop(_State) ->
ok = x_app:stop([]),
ok.
Rebar compiles this code successfully and generates no warnings.
rel/y/bin/y start
outputs nothing at all (I hoped to get the output of at least one io:format
)
rel/y/bin/y stop
outputs Node is not running!