[erlang-questions] How do I include a library across muiltple apps in a release?

Ulf Wiger <>
Sat Aug 30 18:02:04 CEST 2008


The only thing you need to do is to make sure the module is
included in *some* application that is always loaded, no
matter which configuration you happen to run.

A module may not be listed in the 'modules' attribute of
more than one application.

Once loaded, the module can be called from any other module.
The only aspects that are affected by which application a module
belongs to are:

- its place in the supervision hierarchy and ts group leader,
  if it starts processes.
- environment variables (application:get_env(Key)) when the
  application name is not provided.

You'll want to consider your application dependencies.
Creating a new library applciation is much better than introducing
an unclear dependency.

BR,
Ulf W

2008/8/30 Matt Williamson <>:
> I don't think you are answering the question very directly. Are you saying
> that I should include the module in the list of modules for each app file?
>
> On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey <> wrote:
>>
>> you only need to write a .app file
>> from http://erlang.org/doc/design_principles/applications.html#7
>>
>> The contents of a minimal .app file for a library application libapp looks
>> like this:
>>
>> {application, libapp, []}.
>>
>> (I think the docs might be misleading though, I got errors using the
>> minimal,
>> this is what I use
>>
>> {application, appname, [
>>   {description, "Description"},
>>   {vsn, "1.0"},
>>   {modules,[]},
>>   {registered,[]},
>>   {applications, [kernel, stdlib]}
>> ]}.
>>
>> then have systools find that app file when generating the .rel
>>
>> 2008/8/30 Matt Williamson <>
>>>
>>> Let's say I have a typical release directory like so:
>>>
>>> /myrel
>>>     |- lib/
>>>         |- app1/
>>>             |- src/
>>>             |- ebin/
>>>             |- include/
>>>             |- doc/
>>>         |- app2/...
>>>         |- app3/...
>>>
>>> How would I include a single module, which can be called by modules in
>>> all of the applications? The only two ways I can think of is make it into an
>>> app (I personally think that's overkill because I just want to call a
>>> function in the module) or make a symlink, which won't work in windows.
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list