[erlang-questions] Compilation question...

Emil Hellman <>
Tue Jan 30 15:05:01 CET 2007


Hello!

I have a small feature I want to several modules. My thought is to add
this feature if I encounter a '-myfeature(Args)'  in the module.

Example:

-module(foo).
-export([bar/0]).
-myfeature(Args).

Where args could be several different things.

So essentially if I find this "tag" in the module I would like to
append some code to the file (dependant on the args). And then compile
the modified module. However, I don't want the generated code to be
appended to the actual module, simply added temporarily during the
compilation.

To do this I need some guidance. What module(s) contain the code that
is used by the compiler? I checked out 'compile.erl', but I think I
want to do something to the modules before this code is called (though
I might be wrong here).

Any guidance would be greatly appreciated.

Regards,
  Emil



More information about the erlang-questions mailing list