Library

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
rishu
Newbie
Posts: 7
Joined: Thu Jul 17, 2008 4:48 am
Location: indyeah

Library

Post by rishu » Mon Aug 04, 2008 9:16 am

wot a library means?

MilesAway1980
Coder
Posts: 25
Joined: Tue Jul 29, 2008 12:30 pm

Post by MilesAway1980 » Mon Aug 04, 2008 1:56 pm

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.

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo » Mon Aug 04, 2008 2:08 pm

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
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.

User avatar
burger2227
Veteran
Posts: 2431
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Mon Aug 04, 2008 2:33 pm

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!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Post Reply