I’d like to access certain compiler constants (namely, GOBJ_TOTAL_LENGTH and NUM_ATTR_BYTES) from an Inform 6 inclusion in Inform 7-- unfortunately there doesn’t seem to be a good way to do this?
By default, Inform 7 throws saying something like
Problem: unable to find definitions for the following name(s): NUM_ATTR_BYTES.
I7 compiles without complaint, but then I6 decides to complain that
File "Build/auto.inf"; Line 582 # Error: "NUM_ATTR_BYTES" is a name already in use and may not be used as a new constant name (Defined constant "NUM_ATTR_BYTES" was defined at compiler setup).
Is there a good way to do this, or will I just have to hardcode?
My guess is that the complaint about not having a definition is coming from the I6-to-Inter compilation stage (because the Inter compiler doesn’t have that compiler constant) while the I6 error is coming from the I6-to-Glulx compilation stage (because the I6 compiler does have that compiler constant, plus the definition applied during the I6-to-Inter stage where the #ifndef condition was true).
If that’s the case, I’m not sure that there’s any way to write the I6 inclusion such that it will evaluate to the desired value (i.e. the actual value of the compiler constant). Can the I7 compiler decide to change this from its default? If not, maybe you don’t have to worry much about it and can just use your own constant or global with a value of 7.
I believe the new syntax for accessing constants across kits is going to fix this problem, when the next release comes out. Right now the way that works is a big mess which means use options need to be hard-coded into the compiler(!) so that their constants can be accessed in the right places.
You’ve already gotten some workarounds, but the canonical answer is: no, Inform v10 no longer supports accessing constants specific to the I6 compiler because those would be unavailable in any other compilation target.
(Even though, effectively, nobody compiles I7 to anything else yet.)