Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QLB and BI files
#1
I'm trying to understand why the includes of the .BI files don't work the same way with compiled libs (ie QLB files) and with non compiled versions (ie .BAS files, loaded as modules).

Sometimes the .BI seems useless, sometimes it is mandatory, sometimes I get double declaration errors... The user type (eg RegTypeX) must sometimes be declared, sometimes not...

What's the role of the .LIB files ?

Is there a reference tutorial about making a QLB that provides clear answers to these questions ?
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#2
Well, they don't work differently depending on they are for BAS or QLBs files. They work differently depending on contents.

As you can stuff array declarations and COMMONs in .BIs as well, you will get duplicate definitions if those names are used in any of the BAS files which include the .BI files.

The LIB file is a bunch of OBJ files packed together with some extra stuff. They are basically the libraries, which is linked to your .BAS generated .OBJs to obtain the .EXE. The QLBs are always made of .LIBs using LINK.EXE, and are used to provide access to the compiled libraries from the interpreted basic (i.e. they are just for the IDE).

I wrote this tutorial: http://faq.qbasicnews.com/?blast=PushingTheLimitsOfQb that does not cover what you want exactly, but it talks about some of these things.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
You know how to use FUNCTIONs you need both a FUNCTION/END FUNCTION and a DECLARE FUNCTION, right?

Well, a BI file is where you put stuff like the DECLAREs. But they don't have to be there - in fact, if you copy in the entire BI file in place of the '$INCLUDE statement in your BAS file(s), it will still work.

The LIB file is the actual library itself. It contains already-compiled code that gets put into the EXE when you compile your program.

The QLB is a special version of the LIB file that QB can load and use with your uncompiled programs.

So basically, you need the LIB file to compile your program to an EXE, you need the QLB if you want to run your program in QB.
Reply
#4
I finally managed to have the same progs work both in uncompiled and compiled versions, starting from the exact same source codes...

Of course, like in every debugging situation, I can't tell why it did not work, now that it works :lol:

Thanks for all these infos ! Your tuto is really great, Nathan: I already knew it, but I think I will go into its details if I want to be abale to compile TC-Ray one day...

I also have a big zipfile called "WINER" that contains a huge series of tutos by this guy called Ethan Winer. Very, very interesting...
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#5
Well, the whole point of BI files is that when you code a programm with multiple modules and in a certain point of time have to add a new function/sub, you don't have to declare it in each module. You just declare it in the BI file and of course include the BI in each of the modules. Simply said, SUB, FUNCTION, COMMON SHARED and CONST declarations are easily managed in multiple modular programming using the BI files.
Reply
#6
Quote:Simply said, SUB, FUNCTION, COMMON SHARED and CONST declarations are easily managed in multiple modular programming using the BI files.

Yes, as long as you have, for example, two modules only. As soon as you have real multiple modules, with, for example, a given .BI file included into several modules, it can become quite tricky because of the possible double declarations. Then you enter the COMMON SHARED variables techniques, and that's when the risk of getting spaghetti code occurs.

COMMON SHARED, and DIM SHARED have another aspect which is not that easy: arrays declaration. You must declare the arrays without dimensions in the .BI file, and then REDIM them in the .BAS.

These considerations make me say : it's not always easy... :wink:
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#7
Well, what are you coding?
Reply
#8
I'm not really coding as for today, just trying to make all the stuff that will be posted on the v3.0 of my webpage clean: I focused on the result as for now, but coming back on the way the progs work is not bad from time to time.

I never compile my progs, in fact. So today, I'm trying to do it, with, for example, the TC-Lib and TC-Ray: TC-Ray is too heavy to compile, I have to understand why !
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)