[erlang-questions] getting application name in parse transform

Jacob jacob01@REDACTED
Thu Dec 22 20:49:08 CET 2016


On 22.12.2016 17:17, Alex S. wrote:
> No wonder it does, too: get_application does its thing for compiled and
> loaded modules.

The _application_ has to be loaded, the information is taken from the
application_controller's ETS table (which in general gets its
information from the app files). The module itself does not have to be
loaded. So it depends on which modules are loaded by the _compiling_ node.

HTH

Jacob

> 
> 22 дек. 2016 г. 17:22 пользователь "John Doe" <donpedrothird@REDACTED
> <mailto:donpedrothird@REDACTED>> написал:
> 
>     Hi,
>     Is there a way to get in a parse transform the name of the
>     application the module belongs to? The parse_transform function has
>     parameter Options so it is possible to add an argument to erlc with
>     app name, but is it possible to get the name of the app automatically? 
> 
>     I tried
>     {attribute, _, module, ModuleName} = lists:keyfind(module, 3, Forms),
>     application:get_application(ModuleName),
>     but it returns undefined
> 
>     _______________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 




More information about the erlang-questions mailing list