Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

libraries

Status
Not open for further replies.

fancom

Programmer
Joined
Feb 7, 2001
Messages
46
Location
TR
i wrote a program ;

Declare sub makefont (x%,y%,color%,size%,typ%)
'no loop

sub makefont (x%,y%,color%,size%,typ%)
'a little code
end sub


i saved it as a library and then

'$include: 'font.lib'
call makefont(x%,y%,...etc.)

this couldn't recognize back the sub makefont..There was some yellow chr$ codes on the screen..

Now i wonder how can we save our subs and recall them from
our libraries ?..

Or does it mean that i missunderstood the mentatlity of libraries ?..
Help pls..

[COLOR=ffaa33] Shakespare says "To be or not To be"
And we say "I/O"
[/color]




 
You have to start qbasic with the /L parameter. This tells qbasic to support libraries.
 
well i have a .bat file ;
qb.exe /l

for 3 years................


[COLOR=ff9933] Shakespare says "To be or not to be" and we say "1/0"
[/color]

 
put:
Declare sub makefont (x%,y%,color%,size%,typ%)
in your program.
not...
'$include: 'font.lib'

if anything place:
'$include: 'font.BI'

(Basic Include)

which would simply include the text:
Declare sub makefont (x%,y%,color%,size%,typ%)

so for that matter just place the line in your program instead of the include.

the /l switch is what loads the library, not the '$include

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Does QB create the BI?

(btw, you have to go /l then your lib name, otherwise it just loads qb.lib/qbx.lib/vbdos.lib depending on your version)
 
No...

You make a blank text file.

Copy/Paste your declarations into it...

Such as:
Declare Sub/Function ...
Type MyType
X as ...
Y as ...
End Type
Dim Shared Var As ...
Const PI = 3.1415
etc...

Then save it. The .BI extension is optional (It stands for Basic Include)

This is more or less the equivalent of a header (.H) file in C/C++

the difference is (I think... it has been awhile) in basic you can only include 1 file. in c/c++ there is no limit.

Also you can not place commands in include files in basic.
(such as X = Y + 1, or SCREEN 13)

----------------------------------------------
/L (by itself) loads QB.QLB

/L MYLIB loads MYLIB.QLB

when you create EXE, your MYPROG.BAS generates MYPROG.OBJ which is then linked with QB.LIB (or MYLIB.LIB respectively) to create MYPROG.EXE


Details:
MYLIB.BAS is compiled and creates MYLIB.OBJ
MYLIB.OBJ is linked with QB.LIB to create MYLIB.LIB using LIB.EXE
MYLIB.LIB generates MYLIB.QLB using LIB.EXE

MYLIB.QLB is loaded into QB using /L MYLIB

MYPROG.BAS is compiled and creates MYPROG.OBJ
MYPROG.OBJ is linked with MYLIB.LIB to create MYPROG.EXE using LINK.EXE

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top