[erlang-questions] linking modules from other directories

Tamas Nagy <>
Mon Oct 12 13:47:16 CEST 2009


Hi,

The package application is unsupported in Erlang.

That being said calls to other modules do not create compile time  
dependency so I would assume if all the modules are available in  
runtime system util:foo(..) will be fine.
I would recommend reading up on what erlang deployment's usual layout  
is as the tools/system are implemented with that layout in mind.(http://www.erlang.org/doc/system_principles/part_frame.html 
)
This does not mean that you cannot create your own layout but it will  
be harder to make it work.

Erlang has a code path which can be modified with code:add_patha/1,  
code:add_pathz/1 etc. or with the -pa, -pz switches given to the erl  
command etc. (http://www.erlang.org/doc/man/code.html)

Regards,
	Tamas

Tamas Nagy
Erlang Training & Consulting
http://www.erlang-consulting.com

On 12 Oct 2009, at 11:28, kamiseq wrote:

> is there a way to direct erlang that specified module is in another
> directory so it can use it when compiling.
>
> let say my project is like
>
> proj
>     /lib/
>     /inc
>          /header.hrl
>     /src
>          /foo
>               /efoo.erl (where module is defined as -module 
> (foo.efoo) )
>          /baz
>               /ebaz.erl (where module is defined as -module 
> (baz.ebaz) )
>          /main.erl
>          /other.erl
> util
>     /util.erl
>
> so now, how to reference util.erl from main.erl.
> I havent tried that but it seems that I may reference efoo and ebaz  
> from
> main.erl using package notation (ie foo.efoo:countTo5() ), but there  
> is no
> way to reference other.erl from efoo.erl or ebaz.erl.
>
> OR should I just include file (like with header files) and then use it
> normally? util:fun()??? but it will include the other file in my  
> module and
> all I want is point compiler where the module is.
>
> the other thing is that compiler can't catch calls to missing  
> modules (in
> other dirs) it will throw {'module could not be loaded' only in
> runtime..........
>
> is there something like class path for erlang??
> -- 
>
> pozdrawiam
> Paweł Kamiński
>
> 
> 
> ______________________



More information about the erlang-questions mailing list