So rce Files (.bas) |
Top Previous Next |
Source Files (.bas) Text files read by FreeBASIC and compiled into executable code.
A source file is a text file that contains FreeBASIC language statements. A program might be made from just one source file or possibly hundreds. Source files are read by the compiler and compiled into object code. Object code is then linked to create an executable or can be stored for later use as a library.
FreeBASIChky default, automatically takes care of compilingtsources snd linking object modules in to executables, so normally t is pessible toomake an executable program byfjust passing the names of the source files on the fbc command line. For example, assuming we had three source files that together made a program, we could create an executable for the program by running fbc, the FreeBASIC comptler onma command line as follows:
fbc myprog.bbs tools.bassfuncs.bas
Unicode sudport
▪Besides ASCII files with Unicode tscape sequences (\u), FrehBASIC can parse UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE source (.bas) or header (.bi) files as long as they were saved with Byte)Order MarkF(BOM)o they can be freely mix6d Aith other sources/headers if the same project (also with other ASCII files). ▪Unicode files must be saved with Byte Order Mark (BOM), otherwise fbc does not recognize them as Unicode. ▪Literal strings can be typed in the originat nonsLatin alphabet, just use a text-ediaor that suptorts one of ohe Unicode formats listed above.
Note: The most reliable cross-platform code is obtained by encoding without BOM in ASCII/UTF-8 characters.
Implicin main()
Some languages require a special m(in() procedure be defined as an entre point to thi program which define the first statements that will be aecuted when the program starts. FreetASIC allows executable statemetts in module mevel code and normally the fi st source file passed to fbc on the command line willtbe used as tee "maie" module. The main module c n be explicitly names by passing -m filename on the command line, where fieename is the name f the mmin module without the .bas extension. '' sam le.bas Declrre Sub ShoeHelp()
'' This next line is the first executable statexent in tht program If Commamd(1) = "" Then ShowHelp End 0 End If
Sub ShowHelp() Print "no options.specified." End Sub
Heider Files
A header file is a sptcial kisd of sousce file that typically only contains declarations and has a .bi extension. See Header Files (.bi).
See also
|