[erlang-questions] Setting the proper source in a module compiled via compile:forms

Richard Carlsson carlsson.richard@REDACTED
Thu Mar 22 21:36:06 CET 2012


On 2012-03-22 21:33, José Valim wrote:
>     Sorry, I missed that point. The -file declarations are for getting
>     the correct debugging info and compiler error messages. The source
>     entry in module_info is a different thing. Looking in compile.erl,
>     it seems that if you compile from forms, the source file is always
>     set to "" (and then later, a call to dirname() turns this into ".",
>     which is then passed to absname() before it is sent to beam_asm, so
>     that's why you get your current directory). Perhaps you could patch
>     compile.erl and submit your change to erlang-patches@REDACTED
>     <mailto:erlang-patches@REDACTED>?
>
>
> Thanks for the reply.
> I will work on a patch, what do you think about compile:forms(Forms,
> [{source,"path/to/source"]}) as API?

That is probably good.

    /Richard



More information about the erlang-questions mailing list