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

José Valim <>
Thu Mar 22 20:43:38 CET 2012


>
> 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.


Thanks! I have tried the following snippet, still with no success:

1> Code = [{attribute,1,file,{"real/path",1}},{attribute,1,module,demo}].
2> Tuple = compile:forms(Code).
3> code:load_binary(demo, "real/path", element(3, Tuple)).
4> demo:module_info().

module_info still returns pwd as source. I must add I am using R15B.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120322/aef45e6b/attachment.html>


More information about the erlang-questions mailing list