26

What is an .hrl file in Erlang/OTP? Is it some sort of library mechanism?

2240
  • 1,547
  • 2
  • 12
  • 30
yazz.com
  • 57,320
  • 66
  • 234
  • 385
  • 3
    After reading the link you showed maybe me and you should "agree to disagree" on what the definition of "readability" is. But thanks for the link anyway :) – yazz.com Feb 23 '10 at 08:39
  • @dustin: i stumbled over them in "programming erlang" on page 60. so -- there is indeed the possibility to know of the existence without knowing the purpose or contents. – aurora Aug 14 '11 at 17:08

3 Answers3

37

A "header file" akin to a "C" include file.

One needs to invoke the -include directive from an .erl file to use them. Can contain any valid Erlang code.

Community
  • 1
  • 1
jldupont
  • 93,734
  • 56
  • 203
  • 318
  • 1
    You can also use `-include_lib` to include a header file from another application. – Zed Feb 22 '10 at 16:48
  • 1
    @zed: yes, see the following SO question: http://stackoverflow.com/questions/1847918/erlang-what-is-the-difference-between-include-lib-and-include – jldupont Feb 22 '10 at 17:08
9

The actual doc is http://www.erlang.org/doc/reference_manual/macros.html

chikamichi
  • 2,199
  • 1
  • 24
  • 16
7

hrl files are simply erlang "header", that is files containing common definitions that are intended to be included by .erl files.

tonio
  • 10,355
  • 2
  • 46
  • 60