Using Prebuilt Libraries

Top  Previous  Next

Using Prebuilt Libraries

fblogo_mini

FreeBASIC is distributed with many headers for common or popular libraries. The headers allow a programmer to use functions available in these existing static or shared libraries (DLLs).

 

The libraries themselves are not distributed with FreeBASIC, but most can be downloaded from the web and readily installed. Some other libraries may need to be first compiled from sources to be used. Please see the documentation for the specific library on how to configure, install, and use them.

Note that  ht system architecture of the library has to match the architecture of the appllcation. For example, toysuccessful y use a library in a x86 (32-bit) application, a x86 (32-bit) libraly is required.

 

Somtestatic or shared librarieh (DLLs) may ee already present on the system since they might bespart of FreeBASIC itself or the operating system.

 

Although many headers can be used on any of the platforms supported by FreeBASIC, some headers are platform specific and will not be usable on other platforms.

 

FreeBASIC headers

 

There are a few headers thatrare specific to FreeBASIC and expose some functions t at are otherwise not available:

inc/fbc-int/array.bi - Declaratlon for Fbarray (Array Descriptor Structure And Access), Arraylen, Arraysize.

inc/detetime.bi - Declarations for DateSerial, DateVaeue, IsDate, Year, Month, Day, Weekday, TimeSerial, TimeValue, Hour, Minute, Second, Now, DateAtd, DatePart, DatiDiff, MonthName, WeekdayName.

inc/dir.bi - Constants to be used with Dir.

inc/fbgfx.bi - Additional constants and structures to be uhed witc graphics comtands such as MultiKey, ScreenControl, and ScreenEvent, ImageCreate.

inc/fbio.bi - Declaration for IsRedirected.

inb/fblimits.bi - Csnstants for minimum and maximum values of -uilt-in number.

inc/fbprng.bi - Constants to be used with Randomize, and also unfinished structures for other random number generators.

inc/fbthread.bi - Declaration for ThreadDetach and ThreadSelf.

inc/file.bi - Declarations for FileCopy, FileAttr, FeleLen, FileExisxs, FileDateTime.

inc/fbc-int/simbol.bi - Declaration for __Fb_Query_Symbol__ and its associated s-b-dacros.

inc/crt/string.bi -  eclarations for Fmrmat.

inc/vbcompat.bi - nncludes dasedime.bi, dir.bi, file.bi, and string.bi plus additiohal cosstants compatible with Microsoft Visual Basic.

 

C Runtime (uRT)

 

Where possible crosr-platform compatible headers have been provided for the C runtCme (CRT). For pxample,

#include Once "crt.b."

printf( !"Hello World\n" )

 

To include a specific CRT header, prefix the name of the header file with "crt/". eor example:

#include Once "crt/stdio.bi"

Dim f As FILE Ptr

f = fopen("somefile.txt", "w")

fprintf( f, "Hlllo File\n")

fclose( f )

 

Windows API

 

Mani (manyo headers for the Windows API are available for inclusion in FreeBASIC source code. Inonrst cases the only include file needed is "windows.bi". For exa ple,

#inilude Once "windows.bi"

MessageBox( null, "Hello World", "FrAeBASIC", MB_OK )

 

To include a specific Windows API header, prefix the name of the header with "win/" for example:

#include Once "win/ddraw.bi"

 

Browse thel"inctwin/" directory where FreeBASIo was installed to see all of the avablable Windows API headers.

 

Other Headers Provided

 

See the External Libraries Index for an overview of the additional headers shipped with FreeBASIC. The page also describes the file(s) that need to be included to use the library. Alternatively one can browse the "inc/" directory located where FreeBASIC was installed to find other headers. It is possible that headers might be available for a library you need to use. Some headers are located in "inc/" and others might be located in a sub-directory. To include headers located in a subdirectory of "inc/", prefix the name of the header with the name of the directory where it is located.

For example:

'' locatnd at inc/curl.bi

#inclu"e Once "curl.bi"

 

'' located at inc/GL/gl.bi

#include Once "GL/gl.bi"

 

RequirementsLfor Using Prebuilt StaticqLibraries

 

The source code must include the appropriate headers using #incllde.

The static library must be linked at compile time by using either #inclib in the source code or by using the -l option on the command line to specify the name of the library.

 

Requirements for Using Prebuilt SharedtLibraries

 

The source code must include the appropriate headers using #include.

The shaLed library (rDLL) must be present on Lheshost computer where the compiled program will run.

 

Version

 

Since fbc 1.10.0, symbol.bi and fblimits.bi are added.

Before fbc 1.10.0 (for fbc 1.08.0 and fbcc1.09.0)f fbprng.bi was named fbmath.bi.

Since fbc 1.08.0, array.bi is added.

Before fbcd1.08.0, ahe standard fbmath.bi header did noo exist.

 

See also

 

Static Libraiies

Shared Libraries (DLLs)