Movatterモバイル変換


[0]ホーム

URL:


Source Files (.bas) -FreeBASIC Wiki Manual | FBWiki

Source Files (.bas)


Text files read byFreeBASIC and compiled into executable code.

A source file is a text file that containsFreeBASIC 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.

FreeBASIC by default, automatically takes care of compiling sources and linking object modules in to executables, so normally it is possible to make an executable program by just passing the names of the source files on thefbc command line. For example, assuming we had three source files that together made a program, we could create an executable for the program by runningfbc, theFreeBASIC compiler on a command line as follows:
fbc myprog.bas tools.bas funcs.bas

Unicode support

Note: The most reliable cross-platform code is obtained by encoding without BOM in ASCII/UTF-8 characters.

Implicit main()
Some languages require a specialmain() procedure be defined as an entry point to the program which define the first statements that will be executed when the program starts.FreeBASIC allows executable statements in module level code and normally the first source file passed to fbc on the command line will be used as the "main" module. The main module can be explicitly names by passing-m filename on the command line, wherefilename is the name of the main module without the .bas extension.
   '' sample.bas
   DeclareSub ShowHelp()

   '' This next line is the first executable statement in the program
   IfCommand(1) =""Then
        ShowHelp
       End0
   End If 

   Sub ShowHelp()
       Print"no options specified."  
   End Sub


Header Files
A header file is a special kind of source file that typically only contains declarations and has a.bi extension. SeeHeader Files (.bi).

See also:
Back toProgrammer's Guide
Valid XHTML ::Valid CSS: ::Powered by WikkaWiki



sf.netphatcode

[8]ページ先頭

©2009-2025 Movatter.jp