Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
08-07-2024, 01:10 AM
(This post was last modified: 08-07-2024, 01:12 AM by SMcNeill.)
My way of dealing with huge routines is to wrap them inside precompiler blocks.
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.
Posts: 60
Threads: 11
Joined: Apr 2022
Reputation:
7
Wait...whaaaa ?!? I had no clue. I just looked up the page for this command and wow. I gotta play with this...thank you Steve.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
08-07-2024, 02:39 AM
(This post was last modified: 08-07-2024, 02:43 AM by SMcNeill.)
(08-07-2024, 02:17 AM)dano Wrote: Wait...whaaaa ?!? I had no clue. I just looked up the page for this command and wow. I gotta play with this...thank you Steve.
Take a look at my Toolbox, and you'll see how I've configured it for this type of purpose. Feel free to ask if you have any questions.
Github repo --- https://github.com/SteveMcNeill/QB64-Pho...on-Toolbox
Link to forum discussion -- https://qb64phoenix.com/forum/showthread.php?tid=2085
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
(08-07-2024, 02:17 AM)dano Wrote: Wait...whaaaa ?!? I had no clue. I just looked up the page for this command and wow. I gotta play with this...thank you Steve. Yeah, I need to investigate the use of pre-compiler statements further as well. Very powerful tools.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
Wow, a 6 meg exe. What are you running under the hood to get a build that big? Lots of databases would be my guess.
Yeah, upx seems to be the favorite among forum users. Also keep in mind that since QB64 is a C translator, you are not going to get an optimized result as you could if you directly programed your app in C code. Of course you'd also never get the damn app completed, because it takes for forking ever to program large apps in C. Well, at least it does when I've tried it.
Oh, and +1 to Steffan for posting a GUI interface to upx. I did not know that one existed.
Pete
- If you compressed my posts, into the ones worth reading, we'd all suffer through another big-bang event.
Shoot first and shoot people who ask questions, later.
Posts: 60
Threads: 11
Joined: Apr 2022
Reputation:
7
(08-07-2024, 04:03 PM)Pete Wrote: Wow, a 6 meg exe. What are you running under the hood to get a build that big?
To be exact: 24,681 lines (includes basic comments). This is one of our critical operation programs that handles everything from customer PO import and tracking, automatically order creation, shipping logistics, order tracking, and a host of other things. I am definitely a member of the 'If it can be automated...DO IT' club. Accurate automation saves money and increases accuracy (which in turn saves money).
Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
+1 for the reply.
I made a 90,000+ line office related program, originally in QuickBASIC, via a multi-modular construct approach, and breaking it down into about 12 sub-programs I turned into fake .dll's. When I converted it to QB64, one program of 90,000 lines. I think it was something a little over 2 MB.
Pete
Shoot first and shoot people who ask questions, later.
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
(08-07-2024, 04:22 PM)dano Wrote: (08-07-2024, 04:03 PM)Pete Wrote: Wow, a 6 meg exe. What are you running under the hood to get a build that big?
To be exact: 24,681 lines (includes basic comments). This is one of our critical operation programs that handles everything from customer PO import and tracking, automatically order creation, shipping logistics, order tracking, and a host of other things. I am definitely a member of the 'If it can be automated...DO IT' club. Accurate automation saves money and increases accuracy (which in turn saves money). Wow, that sounds exactly like the QB4.5/VBDOS code I created back in the 90's when working as a system administrator. I had each of those functions broken into separate programs though using a combination of flat-file and ISAM database structures to keep track of everything.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Posts: 2,169
Threads: 222
Joined: Apr 2022
Reputation:
103
@ TerryRitchie
It would have been a blast having you at the QBasic Forum back then. Most people during that time wouldn't believe big projects like ours were possible in QB. I lost track of another good guy named Dale Harris, no relation to Knee Pads Harris. He wrote a similar large business app in QB for point of sale. He called it his POS project. I told him it wasn't a POS project, because he needed FreeBAISC for that!
Pete
Shoot first and shoot people who ask questions, later.
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
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.
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. Ok, I've been playing around with this today and the possibilities are now swirling around in my head.
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!
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
|