|
<< Index >> |
FutureBasic |
include | statement | |
|
alis
" resource whose target is a text file. This resource should exist in the resource fork of the "parent" source file.Assign.incl
" which contains the following lines of text:
a = 3
b = 7
Now suppose we write a program like this:
c = a + b
When we compile this program, the result will be identical to this:
a = 3
b = 7
c = a + b
Special treatment for C source and C header files (*.c and *.h):
Such files are copied to the build_temp folder. A #include
statement is inserted in the translated FutureBasic code. This feature provides an alternative to #if def _PASSTHROUGHFUNCTION for mixing C with FutureBasic code.
Special treatment for C static libraries (*.a):
The include statement copies the library file to the build_temp folder; you must also place the name of the library file in the preferences 'More compiler options' field [this causes it to be linked]. The example below is for a library MyLib that exports one symbol (MyLibFunction).
MyLibFunction
include resources "SomeFile.someextension"
The file indicated is copied from the FutureBasic source folder to the application's Contents/Resources/ directory, unless the extension is .nib in which case it is copied to Contents/Resources/en.lproj/.
This statement is the standard way to copy your sound (for example *.aiff), and image (for example *.icns) files into the application package. Nib files are handled by this statement, as an alternative to dragging them to your project window in FutureBasic version 5.
include library
MacOS X frameworks may be specified with the 'include library' statement, which has two forms:
...
The effect of #include
preprocessor directive in the translated C file, and to pass the appropriate linker command to the compiler.
Notes
The
FutureBasic's Project Manager is generally a more convenient way to combine the source code from several different files. However, there are some advantages to using the
FutureBasic does not allow a given file to be included more than once in the source stream. If a second