Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Erlang locate a module

Tags:

erlang

I not sure or I'm unaware of the conventional way that erlang locates a module which isn't located in the default directories. I understand it will look in the compiled folder and erlang's system folders or the folders that - lists:foreach(fun (E) -> io:fwrite("Path: ~s~n", [E]) end, code:get_path()) will produce.

Path: .
Path: /usr/lib64/erlang/lib/kernel-2.16.3/ebin
Path: /usr/lib64/erlang/lib/stdlib-1.19.3/ebin
Path: /usr/lib64/erlang/lib/xmerl-1.3.4/ebin
Path: /usr/lib64/erlang/lib/tv-2.1.4.10/ebin
Path: /usr/lib64/erlang/lib/tools-2.6.12/ebin
Path: /usr/lib64/erlang/lib/syntax_tools-1.6.11/ebin
Path: /usr/lib64/erlang/lib/sasl-2.3.3/ebin
Path: /usr/lib64/erlang/lib/odbc-2.10.17/ebin
Path: /usr/lib64/erlang/lib/observer-1.3.1.1/ebin
Path: /usr/lib64/erlang/lib/hipe-3.10.2.1/ebin
Path: /usr/lib64/erlang/lib/eunit-2.2.5/ebin
Path: /usr/lib64/erlang/lib/erts-5.10.3/ebin
Path: /usr/lib64/erlang/lib/edoc-0.7.12.1/ebin
Path: /usr/lib64/erlang/lib/dialyzer-2.6.1/ebin
Path: /usr/lib64/erlang/lib/debugger-3.2.12/ebin
Path: /usr/lib64/erlang/lib/compiler-4.9.3/ebin

But what's the conventional method for adding additional folders to the default paths or how do you inform a module that it must look elsewhere for a module that isn't included in the default paths?


1 Answers

You can set the ERL_LIBS environment variable in your system to look for additional library files.

like image 167
dethtron5000 Avatar answered May 18 '26 22:05

dethtron5000



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!