Disclaimer
This document is intended to help you use the free version of the
Borland C++ compiler with VIDE. The Borland compiler is a good
compiler, but the free version has some serious deficiencies.
VIDE helps make up for many of the problems, but the
most serious is the lack of a debugger. This issue is
not likely to be resolved soon. The free version is also a bit
thin on its documentation. This situation is likely to improve,
and this document is a small step in that direction.
Getting and Using the Free Borland C++ Compiler 5.5 top
The Borland C++ Compiler 5.5 is available at
http://www.borland.com/bcppbuilder/freecompiler/. You have
to fill out a bunch of web forms, and eventually get to download
the compiler. The download is about 8 Megabytes long.
As an alternative, you can try
this link to get the compiler, and you might be able to skip
all the form filling out.
Once you download, you have to install the compiler. The download
is a self-extracting installer. It is probably a good idea to install
it in the default location: c:\borland\bcc55. Once you've
installed it, you need to read the README.TXT file.
Note:The very first version of BCC32 5.5 released by Borland
was defective - it had broken help files, and left out OpenGL support.
Be sure your version of BCC 5.5 was downloaded after March 10 (or so).
An easy to tell if you have the newer package is to see if the
directory C:/Borland/BCC55/include/gl exists. If you have it,
you have the newer BCC 5.5. (You may have installed BCC55 someplace
other that c:/Borland/BCC55, but the include path remains the same.)
Setting up BCC 5.5 top
Configuration Files
The most important thing you need to do is set up two configuration
files on the \bin directory. The Borland instructions don't
make that location clear. Assuming you installed the compiler to the
default locations, you need to create two files. The first,
C:\Borland\BCC55\bin\bcc32.cfg should contain:
-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The second,
C:\Borland\BCC55\bin\ilink32.cfg should contain:
-L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The purpose of these two files is to allow the compiler to
find the standard system include and library files.
Note that the Borland README.TXT leaves out the \psdk
entry. If you leave that out, then the compiler won't be able
to find all the standard Windows API files contained there.
Also note that you can add other entries to these files to change
the default behavior of the compiler. For example, you might
want to add -wuse- to bcc32.cfg to stop the
compiler from issuing warnings about variables that are declared
but never used. See the next section on specific switches
recommended for VIDE.
Environment Path
In addiion to these two configuration files, you need to add
the compiler \bin directory to the PATH environment
variable. On Windows9x, you edit the file C:\autoexec.bat.
Simply add c:\borland\bcc55\bin to the PATH
command. On NT, you use the system settings menu off the Start
menu to change the PATH in the environment. Note that if
you are using VIDE, you will need to have the VIDE directory
on your path, too.
IMPORTANT WARNING!
The standard Windows header files included with Borland BCC 5.5
(e.g., windows.h) are set up to compile Windows
applications for Windows 2000! This is NOT documented anywhere
in the help files that come with BCC 5.5. There are some
significant differences in some Win32 API calls for
Win2K and earlier Win95, Win98, and WinNT 4.0 versions.
Code compiled for Win2K (which is the default) will not
run correctly on older versions of Windows. Code compiled
for older versions will run on Win2K.
You should consider adding the following 2 lines to your
C:\Borland\BCC55\win32.cfg file if you want code
that works on Windows versions prior to Win2K!
-DWINVER=0x0400
-D_WIN32_WINNT=0x0400
These switches will be added to the compile line by VIDE,
but it would be a good idea to include them in your bcc32.cfg
file as well.
General Notes
Note that many switches can be negated by following it with a
'-'. For example, '-v-' means no debugging information.
If you want to make any of these switches the default behavior,
you can add them to the BCC32.CFG and ILINK32.CFG files in
the /bin directory of the Borland command line tools.
Using Borland C++ with VIDE top
VIDE hides most of the details of using the command line tools
from you. However, underneath it all, the command line tools are still
there. This section explains some of the details of using VIDE
with BCC32.
Borland Configuration files
It is essential that you have the two compiler .cfg
files set up in the \bin directory. The following
files are suggested:
bcc32.cfg
-w
-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The '-w' switch turns on warnings. You might want to
refine the with some '-wxxx-' switches to supress
some of the warnings.
ilink32.cfg
-x
-L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The '-x' switch turns off the map file. If you want to
supress incremental linking, you can add the '-Gn' switch.
VIDE Options
To use VIDE with the Borland compiler, you MUST
set the path to the root of the compiler directory in the
Options->VIDE dialog. You should set the
Borland root: value to the directory of the
Borland compiler (not the \bin directory). If you installed
BCC32 to the default directory, then this would be
c:\Borland\bcc55.
Default Project Values
Depending on whether you generate GUI or a Console application,
the VIDE project file sets some default values. These are visible
in the Project->Edit project editor dialog.
The default compiler flags look like:
-P -O1 -v-. The -P switch
means C++ files, -O1 is optimization for size,
and -v- turns off debugging. Remember that you
may have other switches in the bcc32.cfg file.
The linker flags line looks like:
-v- -Tpe -ap -c -limport32 -l$(BCC32RTLIB).
These switches control the linker, and may change depending
if you have a Console or GUI app. The last two values are
the names of the run time libraries needed. Import32
is always needed, and the other, BCC32RTLIB is the
It can be a static or dynamic version, and cw32.lib
static version is used by default.
The linker also must include a startup object code file, which
varies for GUI ("c0w32.obj") and console apps ("c0x32.obj").
There are also wide-char versions of these two startup libraries.
You can override the defaults by changing the value of
BCC32STARTUP in the project editor.
Runtime Libraries
BCC32 comes with 4 runtime libraries. There are single threaded and
multithreade versions, and a static and dynamic version of each.
The default library is "cw32.lib", the single-threaded static library.
You can use the dyanmic version of this library by changing the
value of BCC32RTLIB in the advanced tab of the project editor
to "cw32i" (no .lib, which is added automatically by VIDE).
You also must either add the -D_RTLDLL define from the defines
tab, or add the -tWR switch (-tWCR for console apps)
to the compiler flags line, and
recompile your program.
You can do switch to the static multi-threaded library ("cw32mt")
or dynamic library ("cw32mti") in a similar fashion.
Specifying Libraries
VIDE allows you to specify libraries to link with on the
Linker flags line of the Names tab of the project editor.
This line is used for linker flags, and the names of
libraries you need to add. You can see the default
-limport32 -l$(BCC32RTLIB) when you create a
new project. You can add your own library names to this
line, preferably before the -limport32 entry.
This -l syntax is not part of the Borland command
line options, but is converted by VIDE to the form appropriate
in the generated Makefile.
BCC32 Quick Reference
BCC32.EXE Switches top
- +filename
- Use alternate configuration file named filename
- @filename
- Read compiler options from the response file filename
- -3
- Generate 80386 protected-mode compatible instructions. (Default for
32-bit compiler)
- -4
- Generate 80386/80486 protected-mode compatible instructions.
- -5
- Generate Pentium protected-mode compatible instructions.
- -6
- Generate Pentium Pro protected-mode compatible instructions.
- -a
- Default (-a4) data alignment; -a- is byte.
- -an
- Align to n. 1=byte, 2=word (2 bytes), 4=double word (default),
8=quad word (8 bytes), 16=paragraph (16 bytes)
- -A
- Use only ANSI keywords. (Extensions like the far and near modifier no
longer recognized.)
- -A- (Default)
- Enable Borland C++ keyword extensions: near, far, huge, asm, cdecl, pascal,
interrupt, _export, _ds, _cs, _ss, _es.
- -AK
- Use only K&R keywords.
- -AT
- Use Borland C++ keywords (Alternately specified by -A-)
- -AU
- Use UNIX V keywords. (Extensions like the far and near modifier no
longer recognized.)
- -b
- Make enums always integer-sized. (Default: -b make enums integer size)
- -B
- Compiles assembly and calls TASM or TASM32. If you don't have TASM in
your path, checking this option generates an error. Also, old versions of
TASM might have problems with 32-bit generated assembler code.
- -c
- Compileource files, but does not execute a
link command.
- -C
- Turn nested comments on. (Default: -C- turn nested comments off.)
- -d
- Merge duplicate strings. (Default)
- -Didentifier
- Define identifier to the null string.
- -Didentifier=string
- Define identifier to string.
- -efilename
- Derives the executable program's name from filename by adding the
file extension .EXE (the program name is then filename.EXE). filename must
immediately follow the -e, with no intervening whitespace. Without this
option, the linker derives the .EXE file's name from the name of the first
source or object file in the file name list.
- -Efilename
- Use filename as the name of the assembler to use. (Default =
TASM)
- -f
- Emulate floating point. (Default)
- -f-
- No Floating Point
- -ff
- Fast floating point. (Default)
- -F
- Uses fast huge pointers.
- -Ff
- Create far variables automatically.
- -Ff=1
- Array variable 'identifier' is near warning. (Default)
- -Fm
- Enables all the other -F options (-Fc, -Ff, and -Fs). Use this to
quickly port code from other 16-bit compilers.
- -gb
- Stop batch compilatoin after first file with warnings (Default: -gb-).
- -gn
- Stop compiling after n messages. (Default: 255.)
- -G
- Optimize code for speed. (Default: -G- optimize code for size.)
- -H
- Generate and use precompiled headers. It might be called BC32DEF.CSM.
- -H-(Default)
- Does not generate and use precompiled headers.
- -Hfilename
- Sets the name of the file for precompiled headers
- -H=filename
- Set the name of the file for precompiled headers to filename.
- -Hc
- Cache precompiled headers. Use with -H, -Hxxx, -Hu, or -Hfilename. This
option is useful when compiling more than one precompiled header.
- -Hu
- Use but do not generate precompiled headers.
- -in
- Make significant identifier length to be n, where n is between 8 and
250. (Default = 250)
- -Ipath
- Set search path for directories for include files to path.
- -jb
- Stop batch compilation after first file with errors. (default: off)
- -jn
- Errors: stop after n messages. (Default = 25)
- -Ja
- Expand all template members, including unused members.
- -Jg
- Generate definitions for all template instances and merge duplicates.
(Default)
- -Jgd
- Generate public definitions for all template instances; duplicates
result in redefinition errors.
- -Jgx
- Generate external references for all template instances.
- -k
- Turn on standard stack frame. (Default)
- -k-
- Turn off standard stack frame. Generates smaller code, but
it can't be easily debugged.
- -K
- Default character type unsigned. (Default: -K- default character type
signed.)
- -lx
- Pass option x to the linker. More
than one option can appear after the -l (which is a lowercase L).
- -l-x
- Disable option x for linker.
- -Lpath
- Set search path for library files.
- -M
- Instruct linker to create a full link map.
- -npath
- Set the output directory to path.
- -O
- Optimize jumps. (Default: on)
- -O1
- Generate smallest possible code.
- -O2
- Generate fastest possible code.
- -Od
- Disable all optimizations.
- -Ox
- There are a bunch of tiny optimizations, but it is probably
only necessary to used -O1 and -O2, so they are not covered here.
- -OS
- Pentium instruction schedluling. (Default: off: -O-S)
- -p
- Use Pascal calling convention. (This is a lowercase p.)
- -pc
- Use C calling convention. (Default same as -pc or -p-)
- -pr
- Use fastcall calling convention for passing parameters in registers.
- -ps
- Use stdcall calling convention (32-bit compiler only).
- -P
- Perform a C++ compile regardless of source file extension. (Default when
extension is not specified. This is an uppercase P.)
- -Pext
- Perform a C++ compile regardless of source file extension and set the
default extension to ext. This option is available because some programmers
use .C or another extension as their default extension for C++ code.
- -q
- Quiet - suppress compiler banner.
- -r
- Use register variables. (Default)
- -rd
- Allow only declared register variables to be kept in registers.
- -R
- Include browser information in generated .OBJ files.
- -RT
- Enable runtime type information. (Default)
- -S
- Generate assembler source compiles the named source files and produces
assembly language output files (.ASM), but does not assemble. When you use
this option, Borland C++ includes the C or C++ source lines as comments in
the produced .ASM file.
- -tW
- Make the target a Windows .EXE with all functions exportable. (Default)
- -tWC
- Make the target a console .EXE.
- -tWD
- Make the target a Windows .DLL with all functions exportable.
- -tWM
- Make a multithreaded application or DLL.
- -tWR
- Target uses the dynamic runtime lib. Can use -D_RTLDLL instead.
- -tWCR
- Target uses the dynamic runtime lib for CONSOLE apps.
- -T-
- Remove all previous assembler options.
- -Tstring
- Pass string as an option to TASM, TASM32, or assembler specified
with -E.
- -u
- Generate underscores for symbols. (Default)
- -Uname
- Undefines any previous definitions of the named identifier name.
- -v
- Turn on source debugging.
- -vi
- Turn on inline expansion (-vi- turns off inline expansion).
- -V
- Create smart C++ virtual tables. (Default) This means the .objs
are compatible only with Borland tools. The V0 and V1 can apparently
be used with other tools, but why?
- -V0
- Create external C++ virtual tables.
- -V1
- Create public C++ virtual tables.
- -Vmd
- Use the smallest representation for member pointers.
- -Vmm
- Member pointers support multiple inheritance.
- -Vmp
- Honor the declared precision for all member pointer types.
- -Vms
- Member pointers support single inheritance.
- -Vmv
- Member pointers have no restrictions (most general representation).
(Default)
- -Vx
- Zero-length empty class member functions.
- -w
- Display warnings on.
- -w!
- Do not compile to .OBJ if warnings were found. (Note: there is no space
between the -w and the !.)
- -wmsg
- Enable user define #pragma messages.
- -w-xxx
- Disable xxx warning message.
- -wxxx
- Enable xxx warning message.
- amb -Ambiguous operators need parentheses.
- amp -Superfluous & with function.
- asm - Unknown assembler instruction.
- aus - 'identifier' is assigned a value that is never used. (Default)
- bbf - Bit fields must be signed or unsigned int.
- bei - Initializing 'identifier' with 'identifier'. (Default)
- big - Hexadecimal value contains more than three digits. (Default)
- ccc - Condition is always true OR Condition is always false. (Default)
- cln - Constant is long.
- cpt - Nonportable pointer comparison. (Default)
- def - Possible use of 'identifier' before definition.
- dpu - Declare type 'type' prior to use in prototype (Default)
- dsz - Array size for 'delete' ignored. (Default)
- dup - Redefinition of 'macro' is not identical (Default)
- eas - 'type' assigned to 'enumeration'. (Default)
- eff - Code has no effect. (Default)
- ext - 'identifier' is declared as both external and static (Default)
- hch - Handler for '<type1>' Hidden by Previous Handler for '<type2>'
- hid - 'function1' hides virtual function 'function2' (Default)
- ibc - Base class '<base1>' is also a base class of '<base2>' (Default)
- ill - Ill-formed pragma. (Default)
- inl - Functions containing reserved words are not expanded inline (Default)
- lin - Temporary used to initialize 'identifier'. (Default)
- lvc - Temporary used for parameter 'parameter' in call to 'function'
(Default)
- mpc - Conversion to type fails for members of virtual base class base.
(Default)
- mpd - Maximum precision used for member pointer type type. (Default)
- msg - User-defined warnings . This option allows user-defined messages to
appear in the IDE message window.
- nak - Non-ANSI Keyword Used: '<keyword>' (Note: Use of this option is a
requirement for ANSI conformance.)
- ncf - Non-const function 'function' called for const object. (Default)
- nci - The constant member 'identifier' is not initialized. (Default)
- nod - No declaration for function 'function'
- nsf - Declaration of static function 'func(...)' ignored.
- nst - Use qualified name to access nested type 'type' (Default)
- ntd - Use '> >' for nested templates instead of '>>'. (Default)
- nvf - Non-volatile function function called for volatile object. (Default)
- obi - Base initialization without a class name is now obsolete (Default)
- obs - Identifier is obsolete. (Default)
- ofp - Style of function definition is now obsolete. (Default)
- ovl - Overload is now unnecessary and obsolete. (Default)
- par - Parameter 'parameter' is never used. (Default)
- pch - Cannot create precompiled header: header. (Default)
- pia - Possibly incorrect assignment. (Default)
- pin - Initialization is only partially bracketed.
- pre - Overloaded prefix operator 'operator' used as a postfix operator.
- pro - Call to function with no prototype. (Default)
- rch - Unreachable code. (Default)
- ret - Both return and return of a value used. (Default)
- rng - Constant out of range in comparison. (Default)
- rpt - Nonportable pointer conversion. (Default)
- rvl - Function should return a value. (Default)
- sig - Conversion may lose significant digits.
- stu - Undefined structure 'structure'
- stv - Structure passed by value.
- sus - Suspicious pointer conversion. (Default)
- ucp - Mixing pointers to different 'char' types.
- use - 'identifier' declared but never used.
- voi - Void functions may not return a value. (Default)
- xxx - Enable xxx warning message. (Default)
- zdi - Division by zero (Default)
- -W
- Creates a Windows GUI application. (same as -tW)
- -WC
- Creates a 32-bit console mode application. (same as -tWC)
- -WD
- Creates a GUI DLL with all functions exportable. (same as -tWD)
- -WM
- Make a multithreaded application or DLL. (same as -tWM)
- -WU
- Generates Unicode application. Uses -txxxx macros in tchar.h.
- -x
- Enable exception handling. (Default)
- -xd
- Enable destructor cleanup. (Default)
- -xf
- Enable fast exception prologs.
- -xp
- Enable exception location information.
- -xp
- Enable slow exception epilogues.
- -X
- Disable compiler autodependency output. (Default: -X- use compiler
autodependency output.)
- -y
- Line numbers on.
- -zAname
- Code class set to name.
- -zBname
- BSS class set to name.
- -zCname
- Code segment class set to name.
- -zDname
- BSS segment set to name.
- -zGname
- BSS group set to name.
- -zPname
- Code group set to name.
- -zRname
- Data segment set to name.
- -zSname
- Data group set to name.
- -zTname
- Data class set to name.
- -zX*
- Use default name for X. For example, -zA assigns the default class name
CODE to the code segment class.
- -Z
- Enable register load suppression optimization.
ILINK32.EXE - Switches top
ILINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
@xxxx indicates use response file xxxx
- -ax
- Specify application type (known x's follow)
- -aa
- Generate a protected-mode executable that runs using the 32-bit Windows API
- -ap
- Generate a protected-mode executable file that runs in console mode
- -Ao:nnnn
- Specify object alignment
- -b:xxxx
- Specify image base addr
- -c
- Case sensitive linking
- -C
- Clear state before linking
- -Dstring
- Set image description
- -d
- Delay load a .DLL
- -Enn
- Max number of errors
- -Gi
- Generate import library
- -Gl
- Static package
- -Gn
- No state files
- -Gpd
- Design time only package
- -Gpr
- Runtime only package
- -Gt
- Fast TLS
- -Gz
- Do image checksum
- -GC
- Specify image comment string
- -GD
- Generate .DRC file
- -GF
- Set image flags
- -GS
- Set section flags
- -H:xxxx
- Specify heap reserve size
- -Hc:xxxx
- Specify heap commit size
- -I
- Intermediate output dir
- -j
- Specify object search paths
- -L
- Specify library search paths
- -m
- Map file with publics
- -M
- Map with mangled names
- -q
- Supress banner
- -r
- Verbose linking
- -Rr
- Replace resources
- -s
- Detailed segment map
- -S:xxxx
- Specify stack reserve size
- -Sc:xxxx
- Specify stack commit size
- -Txx
- Display time spent on link
- -Txx
- Specify output file type
- -Tpd
- Target a Windows .DLL file
- -Tpe
- Target a Windows .EXE file
- -Tpp
- Generate package
- -Ud.d
- Specify image user version
- -v
- Full debug information
- -Vd.d
- Specify subsystem version
- -w-
- Dilable all warnings.
- -wxxx
- Warning control
- def - No .DEF file
- dpl - Duplicate symbol in lib
- imt - Import does not match previous definition
- msk - Multiple stack segment
- bdk - using based linking in .DLL
- dll - .EXE module built with .DLL extension
- dup - Duplicate symbol
- ent - No entry point
- inq - Extern not qualified with __import
- srf - Self-relative fixup overflow
- stk - No stack
- -x
- No map
BCC32 Libraries top
The following is an incomplete listing of the main startup
and runtime libraries included with BCC32. If you have more
details, please send them, and I will include them here.
- OBJ Files
- C0D32.OBJ
- 32-bit DLL startup module
(cod32w: wide-char version; cod32x: no exception handling)
- C0S32.OBJ
- Unknown
- C0W32.OBJ
- 32-bit GUI EXE startup module (c0w32w: wide-char)
- C0X32.OBJ
- 32-bit console-mode EXE startup module (c0x32w: wide-char)
- FILEINFO.OBJ
- Passes open file-handle information to child processes.
Include this file in your link to pass full information about open
files to child processes created with exec and spawn. Works with
the C++ runtime library to inherit this information.
- GP.OBJ
- Prints register-dump information when an exception occurs.
- WILDARGS.OBJ
- If you want wild-card expansion for you console-mode
applications, then you should also link in this file
when you link your console-mode application. It apparently doesn't
work for GUI apps. It does the normal DOS-like wild card expansion
and passes them to argv and argc of your main.
- LIB Files
- CW32.LIB
- 32-bit single-threaded static library
- CW32I.LIB
- 32-bit single-thread, dynamic RTL import library for CW3250.DLL.
To use this import library, you must compile your programs with either
-D_RTDLL or -tWR options to the compiler. This probably applies to the
other "i" libs as well.
- CW32MT.LIB
- 32-bit multithread static library
- CW32MTI.LIB
- Import lib for 32-bit multithread dynamic RTL import library for CW3250MT.DLL
- IMPORT32.LIB
- 32-bit import library
- dxextra.lib
- DirectX static library
- inet.lib
- Import lib for MS Internet DLLs
- noeh32.lib
- No exception handling support lib
- ole2w32.lib
- Import lib for 32-bit OLE 2.0 API
- oleaut32.lib
- Unknown
- uuid.lib
- GUID static lib for Direct3d, DirectDraw, DirectSound,
Shell extensions, DAO, Active Scripting, etc.
- wininet.lib
- Unknown
- ws2_32.lib
- Import lib for WinSock 2.0 API
Help Improve VIDE for BCC top
Please note that VIDE will reamain primarily focused on
the GNU MinGW gcc compiler. However, I do plan to continue
support for the free Borland BCC 5.5. Remember that VIDE is
GPLed, so the code is avaialble for modification.
First, if I've gotten some default behavior wrong, please
suggest a reasonable alternative. But remember, I chose
the defaults here mainly to simplify typical, simple
applications. Advanced users are expected to edit the
Project file or makefile to get more options.
If you don't like the layout of this document
(like tables might be better), chip in and fix
it. I'll fold it back into the standard distriubtion.
The BIG hole is the missing debugger. But the tools
emit debugging information. That mean it would be
possible to write a free debugger to go with this
compiler. I have some ideas on how to approach such
a project, but no time to do it. I think even
a very simple interface that just had breakpoints
and variable value inspection would be a GIANT
improvement. If you are interested in this, send me
some e-mail, and I'll be happy to discuss the
project with you.
Disclaimer top
First, the Borland C++ 5.5 compiler is not the main
compiler supported by VIDE (gcc is). I tried to get
most of the stuff right with the first release (1.07),
but there may be glitches. Help me out, and report
them. I'll try to fix them a soon as I can.
This information was assembled for publicly available sources and
is intended merely to help use VIDE with Borland BCC32.
There is no guarantee of its accuracy, although it
seems to be correct, but may be incomplete.
Last revision: 3-4-00.
No Warranty top
This program is provided on an "as is" basis, without warranty of
any kind. The entire risk as to the quality and performance of
the program is borne by you.
VIDE Reference Manual
Copyright © 1999-2000, Bruce E. Wampler
All rights reserved.
Bruce E. Wampler, Ph.D.
bruce@objectcentral.com
www.objectcentral.com