BCCOSX, the C++ Cross Compiler for OS X

From RAD Studio XE2
Jump to: navigation, search

Go Up to Command Line Utilities Index

The C++ cross compiler for the Macintosh OS X platform is BCCOSX.EXE, and it shares its codebase with BCC32.EXE. You must use BCCOSX rather than BCC32 if you want to create a cross-platform application.

BCCOSX Is Closely Related to BCC32

In general, using BCCOSX is identical to using BCC32.EXE (the Windows-only C++ compiler), except for the following platform-specific options for Mac OS X:

The two compilers share one code base, so the command syntax for the BCCOSX cross compiler has only a few differences from the syntax for BCC32.

BCCOSX does not support structured exception handling (which is Windows-specific).

Command-Line Syntax

bccosx [option [option...}] <filename> [<filename>...] 

Use spaces to separate the command-line compiler name, each option, and the filenames. Precede each option by either a hyphen (-) or a forward slash (/). For example:

BCCOSX -Ic:\code\hfiles 

You can also specify options in configuration (.CFG) files, which are described in a following section, BCCOSX.CFG File.

You can use BCCOSX to send .O files to XLINK. BCCOSX can also generate assembler code (see the -S option), but we do not supply an assembler for Mac OS X.

See the BCCOSX Command-Line Help for Detailed Information

To display the BCCOSX.exe command-line help in the cmd window, include the -h command-line option.

For example, to display a list of the commonly used compiler command-line options, type:


The displayed list indicates the options that are enabled by default (*):

Embarcadero C++ 6.40 for OS X Copyright (c) 1993-2011 Embarcadero Technologies, Inc.
Available options (* = default setting, xxx = has sub-options: use -h -X):
(Note: -X- or -w-XXX will usually undo whatever was set or unset by -X or -wXXX.
 If two options conflict, the last one specified will be used.)
--sysroot Sets the logical root directory for headers, libraries and frameworks
	  (Paths specified in --sysinc or --syslib and those in -F that begin
	   with '/' are prefixed with this value)
--sysinc  Set the system include file search path
	  (if specified, sysroot will be prepended)
--syslib  Set the system library file search path
	  (if specified, sysroot will be prepended)
--framework Specifies a Mac OS X framework to link to (e.g. --framework=Carbon)
--savemem Set maximum SAVEMEM memory (in Mb)
	  (This is the contiguous memory allocated to store global symbols and
	   similar constructs.  Pre-compiled headers use this memory)
--version Show compiler version
--replacehdr Replace header name (e.g. --replaceHeader=a.h=b.h)
--xrtti   Generate extended rtti information
  -3      Generate 80386 protected-mode compatible instructions
  -4      Generate 80386/80486 protected-mode compatible instructions
  -5      Generate Pentium instructions
  -6      Generate Pentium Pro instructions
  -Axxx   Enable ANSI conformance
  -B      Compile to .ASM (-S), then assemble to .OBJ
  -Cxxx   Enable nested comments
  -D      -D<name> defines 'name' as a null string, or use -D<name>=<value>
  -E      Specify which assembler to use
  -F      Add the specified directory to the framework header search path
	    For example, -F/System/Library/Frameworks;/Library/Frameworks
	    NOTE: If --sysroot is specified, paths starting with '/' will have the value of --sysroot prepended.
  -G      Optimize for size/speed; use -O1 and -O2 instead
  -Hxxx   Generate and use precompiled headers
  -I      Set the include file search path
  -Jxxx   Template generation options
  -K      Set default character type to unsigned
  -L      Library file search path
  -M      Create a linker map file
  -N      Hodgepodge of miscellanity (see -h -N)
  -Nd     Macros get a value of "1" by default (-DX => -DX=1)
  -Nt     GNU __typeof(var) support
  -Nv     Allow void& as a valid type
  -O      Optimize jumps
  -P      Perform C++ compile regardless of source extension
  -Q      Extended compiler error information
  -Rxxx   Include browser information in generated .OBJ files
  -S      Compile to assembly
  -T      Specify assembler option, e.g. -Tx
  -U      Undefine any previous definitions of name
  -Vxxx   Compatibility options
  -X      Disable compiler autodependency output
  -Zd     Output global defs as DocBook specs; to specify: -Zd=<file>.c
  -Zn     Disable and/or don't define CodeGear builtins
  -Zx     Output global definitions to XML file.
	      Sub Options:
		-Zx=<filename> Emit only types/declarations in <filename>
		-Zxf[=filename] Skip base type members 
		-Zxm[=filename] Emit macros
		-Zxp[=filename] Emit file & line position
  -axxx   Set data alignment boundary.  Default is -a4; -a- means -a1
  -b      Enable -bi and treat enums as ints from a typechecking point of view
* -bi     Make sizeof(enum x) == sizeof(int) unless explicitly stated otherwise
  -c      Compile to object file only, do not link
  -d      Merge duplicate strings
  -dc     Put strings into the read-only data segment
  -dw     Put strings into the (writeable) data segment
  -e      Specify target executable pathname
* -ff     Fast floating point
  -fp     Correct Pentium FDIV flaw
* -fq     Use quiet floating point compare instruction (FUCOMP)
  -g      Stop batch compilation after n warnings (Default = 255)
  -h      Request help ('-h -' shows all help).  Can be specific: -h -V
  -i      Set maximum significant identifier length (Default = 250)
  -j      Stop batch compilation after n errors (Default = 50)
* -k      Generate standard stack frames
  -l      Pass options to the linker; example: -ls -l-x
  -m      Generate makefile dependency information
  -md     Put dependency info in .d files, not in the object file
  -mm     Ignore system header files while generating dependency info
  -mo     Specify the output file for dependency info
  -n      Set output directory for object files
  -o      Set output filename (-o<filename> or -o <filename> supported)
  -pxxx   Use Pascal calling convention
  -q      Suppress compiler identification banner
  -r      Use register variables
  -rd     Use register variables only when register keyword is employed
  -s      Link using the system's non-incremental linker
  -t      Specify target executable
* -u      Generate underscores on symbol names
  -vxxx   Turn on source debugging
  -w      Display all warnings
  -w!     Return non-zero from compiler on warnings
  -xxxx   Enable exception handling
  -y      Debug line numbers on
  -z      Options for redefining standard segment names
Use '-h <OPT>' for help on a specific option, or
    '-h -' to see all available options.

Displaying Help for Specific Options, Groups such as -Axxx and -Vxxx

You can get more specific information about each of the multiletter options, such as -Axxx (language compatibility and standards compliance) and -Vxxx (backward compatibility).

To do this, use the -h command-line option with the initial letter of the option group (such as -A to specify the -Axxx options). BCC32 will display only the help topics for the specified set of options (such as -Axxx, -Vxxx, or -Wxxx).

For example, to display a description of the -Axxx (language compatibility and standards compliance) options, use the -h and -A command-line options:

C:\>bccosx -h -A
Embarcadero C++ 6.40 for OS X Copyright (c) 1993-2011 Embarcadero Technologies, Inc.
Available options (* = default setting, xxx = has sub-options: use -h -X):
(Note: -X- or -w-XXX will usually undo whatever was set or unset by -X or -wXXX.
 If two options conflict, the last one specified will be used.)
  -A      Enable ANSI conformance
  -AF     Use SUN Forte keywords and extensions
  -AG     Use GNU keywords and extensions
  -AK     Use Kernighan and Ritchie (K&R) keywords and extensions
  -AT     Use CodeGear C++ keywords and extensions (also -A-)
  -AU     Use UNIX System V keywords and extensions
  -An     Use C99 keywords and extensions
  -Ax     Reserve keywords for future C++-0x extensions

In the following example, the BCCOSX command-line help displays details about all the -Vxxx (backward compatibility) options:

C:\>bccosx -h -V
Embarcadero C++ 6.40 for OS X Copyright (c) 1993-2011 Embarcadero Technologies, Inc.
Available options (* = default setting, xxx = has sub-options: use -h -X):
(Note: -X- or -w-XXX will usually undo whatever was set or unset by -X or -wXXX.
 If two options conflict, the last one specified will be used.)
  -V      Compatibility options
* -VA     Generate all global functions in their own virtual/weak segment
  -VC     Do not mangle calling convention into symbols
  -VF     MFC compatibility
  -VF3    Support MFC 3.2
  -VF4    Support MFC 4.0
* -VI     Use Microsoft search algorithm to locate header files
  -VM     Microsoft Visual C++ compatibility
* -VP     PIC code generation
  -Va     Support old-style class arguments
  -Vb     Enable backward compatability with Bcc versions 5.8.2 and earlier
  -Vbc    Don't collapse reference to reference and allow qualified references
  -Vbe    Allow old-style explicit template specialization
  -Vbi    Follow C89 rules for immediates
  -Vbn    Allow calling of non-const or non-volatile member function for a const or volatile object
  -Vbo    Use old Borland overload resolution rules
  -Vbr    Allow old Borland rules for reference binding
  -Vbs    Treat string literals as non-const
  -Vbt    Use old Borland type rules for ternary operators
  -Vbu    Use old Borland rules for using in templates
  -Vbx    Allow explicit template specialization as a member function
  -Vc     Support constructor displacements
  -Vd     Use old C++ for-statement scoping rules
  -Ve     Zero-length empty base classes
  -Vg     Disable lexical digraph scanner
  -Vi     Use old 8.3 search algorithm to locate header files
  -Vl     Use old Borland class layout
  -Vm     Member pointer options
  -Vmd    Use the smallest possible representation for member pointers
  -Vmm    Support multiple inheritance for member pointers
  -Vmp    Honor declared precision of member pointers
  -Vms    Support single inheritance for member pointers
  -Vmv    Place no restrictions on where member pointers can point
  -Vn     Enable new operator names: and, or, and_eq, bitand, etc.
  -Vo     Set (almost) all compatibility flags; used with old code
  -Vp     Push 'this' first, as does Pascal
  -Vr     Reverse order for Multi-character constant
  -Vt     Put virtual table pointer at front of object layout
  -Vv     Use 'slow' virtual base pointers
  -Vw     Emit native code instead of Unicode for multi-byte character
  -Vx     Zero-length empty class members

Include Paths (-I, --sysinc)

BCCOSX resolves the include directives by searching the specified files in the standard include paths followed by the remote include paths.

Remote paths are relative to $(SYSROOT).

$(SYSROOT) is a Windows directory that represents the logical root of the Mac OS X machine. In this location are copied (cached) header files and dynamic libraries necessary for compiling and linking (see PAClient.exe).

The include paths can be controlled with the following options:


Include Path Type




Sets the standard include file search path.



Sets the system (remote) include file search path. $(SYSROOT) is prepended to the specified path.

Remote paths are processed after standard paths are processed.

BCCOSX assumes that include directives of the form #include </...> (angle brackets, paths begin with forward slash) refer to the $(SYSROOT) location.

The commonly used include paths are described in the following table:

Include Path Type





This directory contains C/C++ RTL header files (.h) provided by RAD Studio. Some of these files include C/C++ header files from $(SYSROOT)\usr\include. For more information, see OS X C RTL.


This directory contains Delphi RTL machine generated header files (.hpp).



This directory contains C/C++ RTL Mac OS X header files cached on Windows.

To set the include paths from RAD Studio, see C++ Compiler Directories and Conditionals (for standard include paths) and Remote Profiles Panel (for remote include paths).

Library Paths (-L, --syslib)


Include Path Type




Library file search path.



Library file search path relative to $(SYSROOT).

Standard library paths and remote library paths are processed in the order specified. Thus you can control your library search path by interleaving -L and --syslib options to the compiler.

System Root (--sysroot)

SYSROOT is a directory on the Windows machine that represents the logical root of the remote/target machine. This directory is where files and/or symbolic information from the remote/target machine are cached. The SYSROOT value is used by BCCOSX.EXE to search for include and library files.

To change the SYSROOT value, use the --sysroot option and specify the directory on the development PC where you want the local cache copied.

To set the SYSROOT path from RAD Studio, see Remote Profiles.

Target Options for Cross-Platform Applications (--txxx)

BCCOSX supports the following cross-platform compiler options for specifying the target of a compilation (the -txxx command-line options):

To display command-line help for the -txxx options, enter: > bccosx -h -t.

Option Description
  • -t

Specify target executable

  • -tC
  • -tCD
  • -tCDR
  • -tCDV
  • -tCR
  • -tCV
  • Console application is target
  • Console DLL is target
  • Console DLL that uses dynamic RTL is target
  • Console DLL that uses the VCL is target
  • Console application that uses the dynamic RTL is target
  • Console application that uses the VCL is target
  • -tD

DLL (shared library) is target (.dylib on Mac OS X)

  • -tM on Posix
    (or -WM on Windows)

Multithreaded application is target

  • -tP

Package is target

Some of the -t options are not supported by BCC32, the C++ Command-Line Compiler for 32-bit Windows.


The configuration file for BCCOSX contains the following settings for the cross compiler:

-I"C:\Program Files\Embarcadero\RAD Studio\9.0\include\osx";"C:\Program Files\Embarcadero\RAD Studio\9.0\include\osx\crtl";"C:\Program Files\Embarcadero\RAD Studio\9.0\include\osx\rtl"
-I"C:\Program Files\Embarcadero\RAD Studio\9.0\dinkumware"
-L"C:\Program Files\Embarcadero\RAD Studio\9.0\lib\osx32\release"

You can create your own BCCOSX.CFG file and use it for compiling. The custom BCCOSX.CFG file must be placed in the current directory from where BCCOSX.EXE is invoked.

See Also