The QuickTime framework is included and linked by default; your source code does not need 'include library "QuickTime"'. The OpenGL framework is automatically included and linked if your project uses one of the relevant Headers files such as Tlbx gl.incl or Tlbx agl.incl.
Optional files in the built app package
Copying of specified files into <app>/Contents/Resources
The include resources statement allows you to specify any number of files for copying:
include resources "SomeImage.png" include resources "SomeMovie.mpeg" include resources "SomeSound.aiff"
FBtoC copies such files into the built app package. Note: the files must be in same folder as the FB project or standalone source file.
*.icns file from 'icns' resource (to <app>/Contents/Resources)
Info.plist (in <app>/Contents/)
A consequence of using that generic template is that it indicates FBtoC's generic BlueLeafC.icns as the *.icns file. Hence, the compiled application will display FBtoC's generic BlueLeaf icon.
The user may override the default behavior based on "Info.plist.in" by including a user-supplied Info.plist file in the FB source folder. FBtoC will automatically find the user-supplied Info.plist and use that, thus overriding its default behavior.
In that case, the user will also have to include a *.icns file corresponding to that pointed to by CFBundleIconFile in the custom Info.plist. The user's custom *.icns file can be copied to the compiled application bundle with 'include resources':
Pointer- and Handle-typed functions (the new "as type" syntax)
The warning can be eliminated by supplying a pointer type for the declaration:
appearance button statement for text controls
files$ statement
Examples ("ref" is an FSRef, "url" is a CFURLRef):
open statement
String length errors not reported
Alternative syntax for fn CFSTR()
Dereference a pointer to a 64-bit integer
If an 'icns' resource exists in a project resource file, the 'icns' resource is saved as a file in
FBtoC automatically copies a generic Info.plist into the compiled bundle's Contents directory. That generic Info.plist template can be found in FBtoC at: build_goodies/BuiltApplication.app/Contents/Info.plist.in
include resources "AppIcon.icns"
Ordinary FB functions that return a pointer or Handle give rise to a compiler warning.
local fn MyPointerToSomething
dim as pointer p
//...
end fn = p
In function 'MyPointerToSomething':
warning: return makes integer from pointer without a cast
local fn MyPointerToSomething as pointer // new syntax
dim as pointer p
//...
end fn = p
// Example of a function with arguments
local fn AFuncWithArguments( id as SInt32, size as SInt16 ) as Handle
dim as Handle h
h = fn NewHandle( size )
end fn = h
When creating or changing text controls with the appearance button statement, FB4 ignores the title param, but FB5 inserts the text in the control:
appearance button 1,,,,, "My text", @r, _kControlEditUnicodeTextProc
appearance button 1,,,,, "Changed text"
In addition to FSSpecs, FB5's files$ statement supports FSRefs and CFURLRefs. These do NOT work in FB.
fileName = files$( _FSRefOpen,,, ref )
fileName = files$( _FSRefSave,,, ref )
fileName = files$( _CFURLRefOpen,,, url )
fileName = files$( _CFURLRefSave,,, url )
In addition to FSSpecs, FB5's open statement supports FSRefs and CFURLRefs.
String length errors are not reported by FBtoC-built apps. Instead, strings are silently truncated to the maximum length that will fit in the destination variable.
There is a new syntax, borrowed from Objective-C, for obtaining a CF string from a string literal. In most cases the new form @"foo" is interchangeable with fn CFSTR( "foo" ), but there are differences. @"foo" uses Apple's official CFSTR macro, whereas fn CFSTR( "foo" ) uses a CFSTR emulator in the runtime. The advantage of the '@' form is that it allows escaped characters (preceded by a backslash).
dim as CFStringRef cfstr
cfstr = @"printable ascii" // same as fn CFSTR( "printable ascii" )
cfstr = @"item 1\ritem 2" // embedded return char; same as fn CFSTR( "item 1" + chr$( 13 ) + "item 2" )
cfstr = @"\"" // double-quote char; same as fn CFSTR( """" )
cfstr = @"ƒøµ" // non-ASCII chars; don't do that! Instead use fn CFSTR( "ƒøµ" )
The '@' form requires a string literal (not a string expression).
p.0@ dereferences a pointer to a 64-bit integer (like p.0& for 32 bit integers)