08-09-2024, 07:25 PM
(This post was last modified: 08-09-2024, 07:54 PM by TerryRitchie.)
(08-07-2024, 01:10 AM)SMcNeill Wrote: My way of dealing with huge routines is to wrap them inside precompiler blocks.Ok, I've been playing around with this today and the possibilities are now swirling around in my head.
Code: (Select All)$IF CENTER_TEXT_USED THEN
SUB CenterText(x$, where)
'centering routine
END SUB
$END IF
Now, I can include that source in any other program of mine, for use basically as a library file, and it's NOT going to get added to the compiled EXE. It's going to be skipped over and excluded by default.
IF I want to make use of that routine, I'd need to add one line to the top of my source:
Code: (Select All)$LET CENTER_TEXT_USED = TRUE
I've set my routines to be excluded by our built in precompiler, until we specifically specify to include them in our source. This method ensures that ONLY the code I need is included in my EXE, making it as small as possible with QB64PE.
But, many of them are not possible because $LET is always seen. What is really needed is this:
$IF CENTER_TEXT_USED THEN
$LET MIN_MAX_USED = TRUE
SUB CenterText(x$, where)
'code
'code
'a = MinMax(b, c)
END SUB
$END IF
The $LET statement above needs to be ignored until the $IF...$END IF becomes true. Now the possibilities become increasingly interesting.
OH HOLD THE PHONE!
I must have been doing something wrong, this does in fact work!