Qbasicnews.com
Libraries - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+--- Thread: Libraries (/thread-8780.html)



Libraries - Jeremy - 01-21-2006

Can someone tell me how to use libraries? I know what they are, and what they do, but have never used them in QB. (I want to use them in FB)

Also, how do I make my own libraries?


Re: Libraries - d.j.peters - 01-21-2006

Quote:Can someone tell me how to use libraries? I know what they are, and what they do, but have never used them in QB. (I want to use them in FB)

Also, how do I make my own libraries?
Hello Jeremy,
you need an include file *.bi to declare the function/subs
the sourcecode of the lib *.bas

mylib.bi
Code:
declare myfunc(byval parameter as integer) as integer
inclib "mylib"
mylib.bas
Code:
#include "mylib.bi"
myfunc(byval arg1 as integer) as integer
  return arg1+1
end function
fbc -lib mylib.bas
Code:
'testmylib.bas
#include "mylib.bi"
print myfunc(1)
fbc testmylib.bas
testmylib

i wrote it online not tested but this is the way to build and use libs in FB.
take a look in the FreeBASIC/examples/lib folder.

Joshy