[erlang-questions] compile module from string, containing macro definitions

Chris Newcombe chris.newcombe@REDACTED
Thu Mar 8 18:38:51 CET 2007

On 3/8/07, Mats Cronqvist <mats.cronqvist@REDACTED> wrote:
>   the attached code works without any hacking of OTP. it will compile a string
> with macros. be aware that the macro handling is very limited (but hopefully
> easy to extend).

Excellent -- thankyou very much!  This works perfectly.

BTW, really want to support -include directives too.  Do you know if
compile:forms supports -include itself, or do I need to modify your
scan_and_parse function to handle them?

The documentation says that compile:forms takes the same options as
compile:file, so I am adding the appropriate search-path options [{i,
Directory}, ...], but compile:forms seems to ignore them and I just
get unrecognized-record errors.

Actually, when using your code I get a scan error, so I guess this
means that I need to handle it in the scanner...?

1> <0.151.0>: {1173,374854,738939}: compile_and_execute_code:
error:function_clause  [{lists,

Many thanks again,


More information about the erlang-questions mailing list