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

Richard Carlsson carlsson.richard@REDACTED
Thu Mar 22 20:17:33 CET 2012

On 03/22/2012 07:31 PM, José Valim wrote:
> Hello everyone,
> I am using compile:forms() to compile some forms and return me the binary.
> After I load the binary, I can access my code as expected, except the
> mymodule:module_info(:compile) returns the wrong source:
>  > mymodule:module_info(compile)
> [{options,[]},{version,"4.8"},{source,"/Users/jose/Work"}]
> It seems it is returning my PWD as source. To fix the issue, I have
> already tried:
> -compile([{source,"real/path"}]).
> -file("real/path").

I think you must use `-file("real/path", Line).' (where Line is an 
integer literal). The version with arity 1 (just the file name) is 
probably just treated as an unknown user-defined attribute and ignored.


More information about the erlang-questions mailing list