Page 1 of 1

Library

Posted: Mon Aug 04, 2008 9:16 am
by rishu
wot a library means?

Posted: Mon Aug 04, 2008 1:56 pm
by MilesAway1980
A library is a new set of commands that you can use. For example, some of them offer options of better graphics, sound, etc.

Most, if not all, of them are custom made.

Posted: Mon Aug 04, 2008 2:08 pm
by moneo
rishu wrote:wot a library means?
In Qbasic or Quickbasic, a library is a file which contains packaged code for functions and subs. Each function or sub on the library file is referrenced by it's name.

A program can have the code included by a particular function or sub by invoking it and by including the library file name in the LINK operation.

Based on your needs, you can have more than one library file. You can purchase libraries, and you can also add your own functions and subs to a library.

For example, if you have a function that you use very often in your programs, then it would be handy to have that function on a library. This enables you to not to have to copy the function from one program to the other, avoiding any mistakes.

The only disadvantage to libraries is that you must have them backed-up properly. If you lose a librsry file, all the programs that reference functions and subs on this library will not LINK correctly and not work.

A similar concept to libraries is to have your pre-packaged functions or subs stored on individual files containing the code. In this case, you use
$INCLUDE to insert the desired code into your program.

Using libraries or $INCLUDE is entirely a matter of choice. The results are basically the same.

Regards..... Moneo

Posted: Mon Aug 04, 2008 2:33 pm
by burger2227
Interrupt is a good example of a Library that is used in QB 4.5. To use Absolute or Interrupt in QB45, you need to load the QB Library. That only involves adding /L to the QB.EXE command line, batch file or shortcut: QB.EXE /L

For Interrupt you can also '$INCLUDE: 'QB.BI' at the start of a program to use the RegTypes in QB.BI. You could also make your own RegType in a program if you want.

You can create Libraries for your own SUB's or FUNCTIONs too. You can also find Libraries made for QB on the web and here.

Ted

NOTE: Qbasic.exe does not use a library for Absolute calls!