Microsoft KB Archive/31156

= How to Add Routines to Quick Libraries (.QLB Files) =

Article ID: 31156

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q31156



SUMMARY
The following information describes how to add routines to Quick libraries (.QLB files) using their corresponding .LIB library files or their original .OBJ files.

Microsoft recommends that a .LIB file be maintained for every .QLB file. Maintaining a .LIB file makes it easier to maintain a .QLB file and to identify the Quick library's contents. Note that QLBDUMP.BAS, provided on the QuickBasic release disk, displays the contents of a .QLB Quick library.

This article applies to QuickBasic Versions 4.00, 4.00b and 4.50, to the QuickBasic compiler that comes with Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, and to the QBX.EXE editor that comes with Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.



MORE INFORMATION
Note: The LIB.EXE library manager utility takes .OBJ and .LIB files as input arguments and outputs restructured .LIB library files.

The LINK.EXE linker program takes .OBJ and .LIB files as input arguments and gives .QLB Quick library files for output if you use the LINK /Q option.

The following are three different methods (Examples A, B, and C) for adding a routine to a Quick library:

Example A is as follows:

To add a routine (from any supported language) to a Quick library if the Quick library's matching .LIB library file is present, do the following:

 Suppose you have an object module, MYCODE.OBJ, that you wish to add to the Quick library OLDLIB.QLB. OLDLIB.QLB was previously created from OLDLIB.LIB.  Add the .OBJ file (MYCODE.OBJ) to the .LIB library file. For example, the following line adds the routine MYCODE.OBJ to OLDLIB.LIB and outputs NEWLIB.LIB: LIB OLDLIB.LIB+MYCODE.OBJ,,NEWLIB.LIB;  Do one of the following:

  Create a Quick library (.QLB) from the NEWLIB.LIB file. For example, the following line produces NEWLIB.QLB: LINK /Q NEWLIB.LIB,,,BLB40.LIB; Note: BQLB40.LIB is required for QuickBasic Version 4.00. BQLB41.LIB is required to make Quick libraries in QuickBasic Version 4.00b (and later) or the QuickBasic which comes with the Basic compiler Version 6.00 or 6.00b. QBXQLB.LIB is required to make Quick libraries for the QBX.EXE editor, which comes with Basic PDS Version 7.00.   The following is an equivalent alternative to the step above that also outputs NEWLIB.QLB: LINK /Q OLDLIB.LIB+MYCODE.OBJ,NEWLIB.QLB,,BQLB40.LIB; (Don't forget step 2, or else your .LIB file will contain different routines than your .QLB file.)  </ol>

Example B is as follows:

To add an .OBJ module (from any supported language) to a Quick library, do the following:

  Compile (into .OBJ form) the routines(s) that are to be added. For example, the following line invokes the Microsoft FORTRAN compiler to produce FORSUB.OBJ, a FORTRAN subprogram: fl /c FORSUB.FOR </li>  In the LINK command line, add together the desired .OBJ and/or .LIB files (such as FORSUB.OBJ, MYCODE.OBJ, and OLDLIB2.LIB) to create a Quick library. For example, the following outputs MYCODE.QLB: LINK /Q MYCODE.OBJ+FORSUB.OBJ+OLDLIB2.LIB,,,BQLB40.LIB; Note: BQLB40.LIB is required for QuickBasic Version 4.00. BQLB41.LIB is required to make Quick libraries in QuickBasic Version 4.00b or in the version of QuickBasic that comes with the Basic compiler Version 6.00 or 6.00b. QBXQLB.LIB is required for the QBX.EXE editor, which comes with Basic PDS Version 7.00. </li></ol>

Example C is as follows:

To add a Basic routine to a Quick library, you may do the following (this is not relevant for adding non-Basic routines):

  Invoke QuickBasic and load the Quick library to be updated. For example, the following line loads the Quick library OLDLIB.QLB: QB /L OLDLIB.QLB </li> Load all the Basic subprogram (or FUNCTION) procedures to be added to the Quick library by choosing Load File from the File menu.</li> Choose the Make Library command from the Run menu. The library name specified must be different from the one that was loaded when invoking QuickBasic. In addition, the .LIB file corresponding to the .QLB file must exist or a LINK error will occur. Both the .LIB and .QLB files specified will be updated automatically.</li></ol>

Additional query words: QuickBas BasicCom

Keywords: KB31156

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.