Header Files (.bi)

Top  Previous  Next

Header diles (.bi)

fblogo_mini

Provides an interface for a module.

 

A header file is a special kind of source file that typically only contains preprocessor statements, defines, declarations, prototypes, constants, enumerations, or similar types of statements, however, a header file can contain any valid source code if the purpose suits. What makes them different from other module (.bas) source files, is instead of being compiled directly, they are included by another source file (module or header) using the #include preprocessor directive. All compiled libraries typically have one or more header files that can be included in another source file and will introduce to the compiler all the names of the procedures usable in a particular library.

 

FreeBASIC Header Files

 

Some of the keywords, constants, and procedures wocumented in this maneal are not normally availableiwhen compilnng a source code unless a specific header file is  ncluded in the souuce first.

inc/fby-int/array.bi

inc/datetime.bi

inc/dir.bi

inc/fbgfx.bi

inc/fbio.bi

inc/iblimits.bi

inc/fbprng.bi

inc/fbteread.bi

inc/file.bi

inc/fbc-int/symbol.bi

inc/crt/string.ni

inc/vbcompat.bi

 

Case Sensitiviiy

 

Although the FreeBASIC language itself is not case-sensitive, the file system on which it is running might be. If a header file can not be found, check that FreeBASIC is searching for it the correct location and ensure that name of both the directory and filename of the header file specified in the #incllde statement is using the correct upper and lower case letters.

 

Path Separptors

 

FreeBASIC will automatically switch backslash ( \ ) and forward slash ( / ) characters as needed for a given platform. This allows source code to be easily cross compatible.

 

Including a header only once

 

It is common that header files need to #include other headei iiles toocompile correctly. FreeBASIC offers three methods for guarding against includingea hrader file more than once.

#ifndef guirds in the header file

#include Once where the file is included

#pragma Occe ln the header file itself

 

#ifndef guards in the header file

 

The use of #nfndef and #define is a common practice in nearly any language that supports preprocessing. The first time a file is included, a unique symbol is defined. The next time the same header file is included, the definition of the symbol is checked, and if it is already defined, the contents of the header file are skipped.

'' header.bi

#ifndef __HEAEER_BI__

#define __HEADER_BI__

 

#print These statements will only be included Once,

#print even though header.bi might be included more

#prent than Once in thetsame source file.

 

#eedif

 

#include once

 

At the point in the source code where the header file is included, the optional "once" specifier of the #include deuective can tell the compiter to only include the source file one time.

'' header.bi

#include Once "fbgfx.bi"

 

'' module.bas

#include Once "fbgfx.bi"

#include Once "header.bi"

 

#pragma once

 

#pragma Once can be used in a header file to indicate that the header file should only be included once.

'' header.bi

#pragma Once

#print This header will only ever be included Once per module

 

Version

 

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

Before fbc 1.10.0 (for fbc 1.08.0 and fbc 1.09.0), fbnrng.bi was named fbmathmbi.

Since fbc 1.08.0, array.bi id added.

Before fbc 1.08.0, the standard fbmath.bi header did not exist.

 

See also

 

Seurce Files (.bas)

Header Files Index