compile error illegal_record_info

15 views
Skip to first unread message

Jason

unread,
Jul 17, 2020, 5:43:41 AM7/17/20
to ChicagoBoss


Hi guys, I'm trying to call record_info(fields, RecName) in a macro, But there is an error when compile。
I know what macro and record mean, It's no problem on another project.





Manuel Rubio

unread,
Jul 17, 2020, 9:12:39 AM7/17/20
to chica...@googlegroups.com, Jason

Hi Jason,

I recommend to translate that macro to a normal function, if you are not exporting it, it's going to be optimized to become one-line statement:

db_select_records(DBRef, RecName, Key, Value) ->
    gm_server_database:select_records(DBRef, RecName, record_info(fields, RecName), Key, Value).

This way the errors could have more sense.

Kind regards,
Manuel Rubio.

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/ca297b89-e939-486a-8934-3f2613bc3c23o%40googlegroups.com.

Jason

unread,
Jul 20, 2020, 2:06:38 AM7/20/20
to ChicagoBoss

Hi Rubio, Thanks for your reply

I tried to do that you told me, but it still had an error.

in my view, the record_info/2   is run before the compile-time after the pre-compile time

so I just wanna use the macro to replace record's name at the pre-compile time

I think it's going to be gm_server_database:select_record(db_ref, role, record_info(fields, role), "id", 10)

it only has an error in ChicagoBoss, in other projects, I have done it, it's ok, no problem. 

thanks for your help, Rubio, I'm not good at English, please forgive I'm unable to express my gratitude.

在 2020年7月17日星期五 UTC+8下午9:12:39,Manuel Rubio写道:

Hi Jason,

I recommend to translate that macro to a normal function, if you are not exporting it, it's going to be optimized to become one-line statement:

db_select_records(DBRef, RecName, Key, Value) ->
    gm_server_database:select_records(DBRef, RecName, record_info(fields, RecName), Key, Value).

This way the errors could have more sense.

Kind regards,
Manuel Rubio.

El 2020-07-17 11:43, Jason escribió:



Hi guys, I'm trying to call record_info(fields, RecName) in a macro, But there is an error when compile。
I know what macro and record mean, It's no problem on another project.
 
 


--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chica...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages