[erlang-questions] bug in escript and a question

Joe Armstrong erlang@REDACTED
Tue Oct 5 15:27:13 CEST 2010


On Tue, Oct 5, 2010 at 10:38 AM, zabrane Mikael <zabrane3@REDACTED> wrote:
> Hi Joe,
>
> The "-include(...)" works fine like this:

No no no ...

I think you meant  to say "-include(...) does not work, but there is a
work-around
involving "-include_lib(...)" which does work ..

I just wondered why - it's a bit of a bother creating an extra
directory for no apparent reason

/Joe

>
> !/usr/bin/env escript
> %% -*- erlang -*-
> %%! -pz ../mycode ebin
>
> -include_lib("mycode/include/my.hrl").


>
> Regards
> Zabrane
>
> 2010/10/5 Joe Armstrong <erlang@REDACTED>:
>> This escript fails
>>
>>
>>  +-------------------------------------
>>    -record(b,{this=that}).
>>
>>    main(_) ->
>>       io:format("B=~p~n",[#b{}]),
>>       halt(1).
>>  +-----------------------------------
>>
>> The code is between the lines marked +------
>>
>> This is what happens
>>
>> $ escript b 12
>> b:3: record b undefined
>> escript: There were compilation errors.
>>
>> If you add a single blank or comment before the record declartion then it works
>>
>>  +-------------------------------------
>>   %% comment
>>    -record(b,{this=that}).
>>
>>    main(_) ->
>>       io:format("B=~p~n",[#b{}]),
>>       halt(1).
>>  +-----------------------------------
>> $ escript b 12
>> B={b,that}
>> joe@REDACTED:~/work/c_compiler/bic_current/src$
>>
>> Now it works
>>
>> Also -include(..) just doesn't work but -include_lib(...) does.
>> I cannot think why this should be so - is there any good reason for this?
>> I can't think of one.
>>
>> Cheers
>>
>> /Joe
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>>
>
>
>
> --
> Regards
> Zabrane
>


More information about the erlang-questions mailing list