include

FBtoC enhancements

1. include "SomeFile.someextension"

In general the file is treated as an FB source file.

1a. Special treatment for C source and C header files (*.c and *.h)

include "SomeFile.c"
include "SomeFile.h"

Such files are copied to the build_temp folder. A #include statement is inserted in the translated FB code. This feature provides an alternative to #if def _PASSTHROUGHFUNCTION for mixing C with FB code.

1b. Special treatment for C static libraries (*.a)

include "MyLib.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).

include "MyLib.a"
BeginCDeclaration
// let the compiler know about the function
void MyLibFunction( void ); // in lieu of .h file
EndC

// let FBtoC know about the function toolbox MyLibFunction() MyLibFunction() // call the function

2. include resources "SomeFile.someextension"

The file indicated is copied from the FB 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 FB5.

3. include library
OS X frameworks may be specified with the 'include library' statement, which has two forms:

include library "Framework/Header.h"
include library "Framework" // optional short form, expanded internally to: include library "Framework/Framework.h"

// tell the compiler the framework and header
include library "AddressBook/AddressBookUI.h"
// tell FBtoC the functions
toolbox fn ABPickerCreate() = ABPickerRef
...

The effect of 'include library' is to insert the appropriate #include preprocessor directive in the translated C file, and to pass the appropriate linker command to the compiler.

The QuickTime framework is #included and linked by default; your source code does not need include library "QuickTime". OpenGL is automatically #included and linked, if your project uses one of the relevant Headers files such as Tlbx gl.incl.

See Apple documentation: Mac OS X Frameworks