Libraries, how do I use them?
Libraries, how do I use them?
I'm asking what I do to use libraries. Most specificly .a libraries. Any help is much appreciated.
You can either use the .bi file that includes the .a file or you can include it manually, like so:
If you want to use a .bi file you do it like this:
Code: Select all
#Inclib "somelib"
If you want to use a .bi file you do it like this:
Code: Select all
#include "some.bi"
library
question for IMORTIS
I have searched for information on libraries. What I seem to find is "make that subprogram a library and use it".
OK. That is just what I want to do.
How do I turn a .bas into a .bi ?
Could you point to some tutorials that might give some verbose explanations about how to generate a library?
After I create the module with several routines ( minisubs.bas ) do I merely rename it "minisubs.bi" and then call use the #INCLUDE directive or is there something else that needs to be done.
At this moment my program(s) uses the include directive for the subprograms that I need. What I would like to do ( and I believe a library is the way ) is compile my subprograms and merely link them each time I need to compile the main program.
As it is ALL of the routines in the minisubs.bas is recompiled every time I make a change to the main program. Most of the subprograms are fixed and rarely will need to be changed. The Main program is only a few hundred lines, but the subprograms are approaching several thousand lines.
I'm not asking something simple, such as integrating a polynomial (since any one who has gone to elementary school can do that), for me this is a very complicated complex intricate problem: module --> library
Some things are very easy and some easy things aren't.
Thanks for any help.
I have searched for information on libraries. What I seem to find is "make that subprogram a library and use it".
OK. That is just what I want to do.
How do I turn a .bas into a .bi ?
Could you point to some tutorials that might give some verbose explanations about how to generate a library?
After I create the module with several routines ( minisubs.bas ) do I merely rename it "minisubs.bi" and then call use the #INCLUDE directive or is there something else that needs to be done.
At this moment my program(s) uses the include directive for the subprograms that I need. What I would like to do ( and I believe a library is the way ) is compile my subprograms and merely link them each time I need to compile the main program.
As it is ALL of the routines in the minisubs.bas is recompiled every time I make a change to the main program. Most of the subprograms are fixed and rarely will need to be changed. The Main program is only a few hundred lines, but the subprograms are approaching several thousand lines.
I'm not asking something simple, such as integrating a polynomial (since any one who has gone to elementary school can do that), for me this is a very complicated complex intricate problem: module --> library
Some things are very easy and some easy things aren't.
Thanks for any help.
-
- Posts: 84
- Joined: Feb 03, 2007 2:37
More information can be found here:
http://www.freebasic.net/wiki/wikka.php ... cLibraries
http://www.freebasic.net/wiki/wikka.php ... cLibraries
How do I turn a .bas into a .bi ?
You don't really. A .bi simply contains all the declarations for your .bas. I'll make a small example:
ex.bas
Code: Select all
Sub test(a as integer)
Print a
end sub
If that is your .bas, this would be the .bi:
ex.bi
Code: Select all
Declare Sub test(a as integer)
After I create the module with several routines ( minisubs.bas ) do I merely rename it "minisubs.bi" and then call use the #INCLUDE directive or is there something else that needs to be done.
In Order to make a true library (.a file) you will need to compile the code with the -lib option. You do this from the command line. Using the ex.bas file above, you would type this at the comand line:
Code: Select all
fbc -lib ex.bas
If you use FBEdit, it had the library complie option by default in it's make options.
To the end of your ex.bi file you would add this:
Code: Select all
#inclib "libex.a"
Also, the .a file made from you .bas needs to be put, either in the same folder as the code that will be using it, or in the lib folder in the compiler folder.
Then, in the code you are using the library in, you would put this at the top of the program:
Code: Select all
#include "ex.bi"
If you need more help, let us know.
Who is online
Users browsing this forum: No registered users and 7 guests