[erlang-questions] error compiling old xmerl with r13b

Tuncer Ayaz tuncer.ayaz@REDACTED
Wed Aug 5 22:38:24 CEST 2009


On Wed, Aug 5, 2009 at 9:08 PM, Garry Hodgson<garry@REDACTED> wrote:
> i'm trying to build some ancient code of ours using r13b,
> and have hit a snag having to do with records.  the code
> in question is an old version of xmerl (0.17).  boiled down

R13 includes xmerl 1.2 if that is of any help.

> to its essence, i have two files:
>
> foo.hrl:
>
> -record( xmlContext, { axis_type = forward }).
>
> foo.erl:
>
> -module(foo).
>
> -record(state, {context = #xmlContext{}, acc = []}).
>
> foo() -> bar.
>
> when i compile foo.erl using erlc from r13b, i get:
>
> --> erlc foo.erl
> ./foo.erl:7: record xmlContext undefined

I'm not sure how it was back in the day but nowadays
one normally includes the .hrl file for the definition.

> ./foo.erl:7: Warning: record state is unused
> ./foo.erl:10: Warning: function foo/0 is unused

The warnings are correct.

> compiling using our old r9C setup works fine.
> i don't want to invest a lot of effort in updating the old code,
> since the only reason i need to build it with r13b is to compare
> its performance with a completely rewritten version that doesn't use
> xml at all.
>
> i assume something has changed in the language.  can anyone tell
> me what, and what i need do to fix this with minimal effort?

The following is ok.

%% foo.hrl
-record( xmlContext, { axis_type = forward }).

%% foo.erl
-module(foo).
%% if you don't export foo and do not use
%% otherwise it is not used and that's the
%% cause for the warning.
-export([foo/0]).
%% include foo.hrl for knowing about the xmlContext record
-include("foo.hrl").
-record(state, {context = #xmlContext{}, acc = []}).

foo() ->
  #state{context=#xmlContext{axis_type=backward}, acc=[7,2,5]}.


More information about the erlang-questions mailing list