[resolved] con vs constant
kuroneko
Posts: 3,623
I have the need to export some constants from an object which are based on labels in a DAT section. While compile time evaluation with constant() works I'd rather have something inside a CON section (so I can access the values by obj#constant). The latter doesn't seem to work however. The only solution so far is updating the CON section after potential code changes which is prone to errors. Is there a better solution or is this it, no DAT based expression inside a CON section?
Post Edited (kuroneko) : 6/11/2009 1:51:56 AM GMT
CON size = 8 PUB null PUB getSize return constant(@table_end-@table) DAT table long -1 long -2 table_end DAT
Post Edited (kuroneko) : 6/11/2009 1:51:56 AM GMT
Comments
Nope. That is the best you can do. The CON section is parsed first, well before anything in the DAT section is parsed. There is no way to set a constant based on any calculated value outside of the CON block.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Eccles : How do I open the door?
Bluebottle : You turn the knob on your side
Eccles : I haven't got a knob on my side!