Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: zoasterboy on November 03, 2006, 09:35:19 PM



Title: Library help
Post by: zoasterboy on November 03, 2006, 09:35:19 PM
How do you create/use a library in QB?


Title: Library help
Post by: zoasterboy on November 04, 2006, 08:31:01 PM
Fine... Ill find a tutorial somwhere.


Title: Library help
Post by: E.K.Virtanen on November 06, 2006, 07:48:09 PM
Quote from: "www.ascii-world.com"

Itīs not just once or twice when some one have asked that why and how to use and make library with QBasic.
You can use libraryes as you use Subīs and Functionīs.
Library is really easy to create and you can add there routines and codes that are used
in your programs often, just as you use Subīs and Functions.
Well, why use own library instead of Subīs or Functions?
In QBasic is a limit that all knowīs. Itīs called 64K barrier.
But using your own libraryes, you can avoid it.
EXEīs are created on QBasic with two program co-operation.
At first it will be compiled as a OBJ file with BC.EXE and after that
it will be linked to EXE with LINK.EXE.
Libraryes are added on your program on linking part, after BC.EXE compileīs your program to OBJ.
64K limit is on BC.EXE program not on LINK.EXE anymore (when libraryes are added also) so basicly
you can do this way programs what sizeīs can be more than 64K. In matter affact, there are
no limits then.

Here is a simple example how to create and use your own library.
Start QB.EXE with no parameters.


Code:

Sub PrintMe
Print " I made it!!!"
End Sub


Now you gotta make it as a library. Just go on "Run" and choose "MAKE LIBRARY..."
Ok, so now you got a library there.
Now quit your QBasic and re-start it with parameter
QB.EXE /L YourLibrary.QLB
Now, type these line and you see how it works.


Code:

Declare Sub PrintMe Alias "PrintMe" ()
Print "Now we move on library..."
Call PrintMe
Print "...and now we are back on main program."
End


Now, press F5 and see what happends ;)


Title: Library help
Post by: zoasterboy on November 07, 2006, 01:22:12 AM
Kewl thanks.