Question

I have a mnesia table callable from two modules- obviously both modules needing to refer to the records of the table.

Is there any way to declare the record type in one module and use it in the other module, without having to redefine and maintain the declaration in two modules? At the moment I had to declare the record type in each module.

Was it helpful?

Solution

You can declare it in an include file (in the typical app, it would be found in an include directory from the root of the app), then include it in each module.

-include("myrecords.hrl").

To see a practical example, I'll refer you to the rebar repo so you can see how this is typically structured: https://github.com/rebar/rebar

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top