Yes that's what I thought... "will not work" as in "will fail" as in... will just skip over it and not include the lines at all.mtettmar wrote:Yikes
""Will not work where Include> references scripts via variables other than SCRIPT_DIR". "
This is in the section about static includes, so it refers to whether a file will be statically included or not (not being the opposite: dynamic). So if the include references a custom variable the file will still be a dynamic include - just as when not compiled.
So:
With this option checked any includes referencing filenames which can only be resolved at runtime will therefore be dynamic. (It doesn't fail as I think you believe - it just continues to be dynamic - this may be desired and is not an error - so there is no error or warning)
If that line in the Help File was re-worded more like the following then (to me) it would be clearer:
a more wordy but harder to misunderstand version wrote:"However, if the Include> references scripts via variables other than SCRIPT_DIR then those script files can only be resolved at runtime so the Include> will continue to be dynamic (lines pulled in at runtime)."
Sure it will, if that file exists at compile time... but what happens if it does not exist at compile time? Is that Include> then treated dynamically i.e. when we actually run that exe, will it "look again" to see if that file exists and suck in the lines... or... has the compiler just silently omitted this Include> line? My guess is, it will be treated dynamically.mtettmar wrote:With this option checked any includes referencing SCRIPT_DIR will be static.
And if it does not exist at compile time, it will be dynamic, got it, thx.mtettmar wrote:With this option checked any includes where the file is literal and exists at compile time will be static.
Got it, thx.mtettmar wrote:With the option unchecked all includes will remain dynamic and none will be "sucked" into the .exe.
So basically, with that box checked, it will "try" to compile an Include> statically, but if it can't because the scriptfile can't be resolved at compile time due to variables other than SCRIPT_DIR or because the file does not yet exist... then the fallback is ALWAYS to treat it dynamically... got it, thx.
And that's why you never ever show a warning at compile time... because maybe all will be well at runtime.
So then, at run time, the Include> line runs and what if the file still does not exist? Is an error or warning displayed? I compiled the following script in MS v12.1.10 with the box checked:
Code: Select all
Include>C:\my_file_that_will_never_exist.scp
MDL>did we diplay an error or warning?
I am now seeing that you don't even consider this an error because hey, maybe the "next time" the user runs that exe, the referenced file will be there and the lines will be sucked in.
I could still see the possible addition of another Compile Option called:
- Compile Includes Strict (warnings enabled)
which would only be selectable if there was already a check beside Compile Includes... basically, for users who want to static compile and want to be certain ALL their included code gets included. Additionally choosing "Strict" would tell the compiler to display warnings when compiling if a referenced scriptfile on an Include> line was not found.
But... I personally don't need this feature... someone that uses a ton of Include> statements and wants to compile statically might appreciate it... but I am now happy just knowing how it does work.
I'll just make sure to never make a typo on an Include> line... because I now know we'll never see a warning or error msg about it and I see why you've gone that way.
Thanks again for the clarification... much appreciated.