Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64PE v 4.4.0
#3
(01-29-2026, 02:21 PM)bplus Wrote:
Quote:It also makes building libraries easier, as everything (CONST, TYPE, DIM, SUB, FUNCTION) can go into the same file now.

dang! I just got 4.3 setup! But this (above) is good reason to update.

And so now can the $Include statement be put anywhere in the program as well? Though putting it at top makes the most sense for clarity. Don't think it will be good inside a subroutine though.

Put it at top.   You want to put your SUBS with your DIM statements, not your DIM statements with your SUBs.

Imagine this:

Code: (Select All)
LIBRARY with the following code: 
  DIM foo
  SUB whatever
END LIBRARY

Now you write your main program

foo = 3
'$INCLUDE:'This_sexy_Library.BI'

Can you visualize what you've done here?  You've basically assembled your code so it would be like:

foo = 3
DIM foo
SUB whatever

See where you're trying to use that variable before you DIM it?  That's not what you want!



So instead, let's change the order of those statements:

Code: (Select All)
'$INCLUDE:'This_sexy_Library.BI'
foo = 3

Now what you've basically have here would be this:

DIM foo
SUB whatever
foo = 3

Since SUBS can now go between code, all is well and good and life is happy for you.  You have your variable DIMmed properly.  The sub works.  Life is good.

So put those combined library files at the TOP of your code so the DIM and such can be there first.  Putting them after your code probably isn't what you were looking to accomplish at all.
Reply


Messages In This Thread
QB64PE v 4.4.0 - by SMcNeill - 01-29-2026, 02:09 PM
RE: QB64PE v 4.4.0 - by bplus - 01-29-2026, 02:21 PM
RE: QB64PE v 4.4.0 - by SMcNeill - 01-29-2026, 02:39 PM
RE: QB64PE v 4.4.0 - by bplus - 01-29-2026, 04:44 PM
RE: QB64PE v 4.4.0 - by zaadstra - 01-29-2026, 05:49 PM
RE: QB64PE v 4.4.0 - by Pete - 01-29-2026, 06:32 PM
RE: QB64PE v 4.4.0 - by Dav - 03-04-2026, 08:32 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)