Version 1.9
Notice of Copyright
Copyright 2002-2010 the Open Watcom Contributors. Portions Copyright 1984-2002 Sybase, Inc. and its subsidiaries. All rights reserved. Any part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of anyone. For more information please visit http://www.openwatcom.org/
ii
Table of Contents
1 Introduction to Open Watcom C/C++ .............................................................................................. 1.1 What is in version 1.9 of Open Watcom C/C++? .............................................................. 1.2 Technical Support and Services ......................................................................................... Resources at Your Fingertips ....................................................................................... Contacting Technical Support ...................................................................................... Information Technical Support Will Need to Help You .............................................. Suggested Reading ....................................................................................................... C Programmers .................................................................................................. C++ Programmers ............................................................................................. DOS Developers ................................................................................................ Extended DOS Developers ................................................................................ Windows 3.x Developers .................................................................................. Windows NT Developers .................................................................................. OS/2 Developers ............................................................................................... Virtual Device Driver Developers .................................................................... 2 Installation ........................................................................................................................................ 2.1 Hardware and Software Requirements .............................................................................. 2.2 The README File ............................................................................................................ 2.3 Installing Open Watcom C/C++ ........................................................................................ 2.4 Incremental Installation ...................................................................................................... 2.5 System Configuration File Modifications .......................................................................... 2.6 Installation Notes for Windows 3.x ................................................................................... 2.7 Installation Notes for OS/2 ................................................................................................ 3 Hands-on Introduction to Open Watcom C/C++ .............................................................................. 3.1 Outline ................................................................................................................................ 3.2 The Open Watcom C/C++ Tutorial ................................................................................... Defining a Project ......................................................................................................... Adding Multiple Targets .............................................................................................. Making a Target ............................................................................................................ Making All Targets ....................................................................................................... Executing the Program ................................................................................................. Smart Editing ................................................................................................................ Debugging the Program ................................................................................................ Using the Source Browser ............................................................................................ Correcting an Error ....................................................................................................... Editing a Bitmap ........................................................................................................... Editing Menus ............................................................................................................... Sampling and Profiling an Executable ......................................................................... Saving the Project and Terminating the Session .......................................................... 3.3 Tutorial Review .................................................................................................................. 4 Documentation ................................................................................................................................. 4.1 Accessing On-line Documentation .................................................................................... On-line Documentation under DOS ............................................................................. On-line Documentation under Windows ...................................................................... On-line Documentation under OS/2 ............................................................................. 5 Benchmarking Hints ......................................................................................................................... 6 Release Notes for Open Watcom C/C++ 1.9 .................................................................................... iii 1 1 3 3 4 4 4 4 5 5 5 5 6 6 6 7 7 7 7 9 9 10 10 13 13 14 14 17 17 17 18 19 21 23 24 25 26 28 29 30 31 32 32 33 34 37 39
Table of Contents
6.1 Differences from Open Watcom version 1.8 ..................................................................... 6.2 Differences from Open Watcom Version 1.7 .................................................................... 6.3 Changes in 1.8 that may Require Recompilation ............................................................... 6.4 Differences from Open Watcom Version 1.6 .................................................................... 6.5 Changes in 1.7 that may Require Recompilation ............................................................... 6.6 Differences from Open Watcom Version 1.5 .................................................................... 6.7 Differences from Open Watcom Version 1.4 .................................................................... 6.8 Differences from Open Watcom Version 1.3 .................................................................... 6.9 Changes in 1.4 that may Require Recompilation ............................................................... 6.10 Differences from Open Watcom Version 1.2 .................................................................. 6.11 Differences from Open Watcom Version 1.1 .................................................................. 6.12 Differences from Open Watcom Version 1.0 .................................................................. 6.13 Differences from Version 11.0 ......................................................................................... 6.14 Changes in 11.0 that may Require Recompilation ........................................................... 6.15 Major Differences from Version 10.6 .............................................................................. Changes to the C++ Compiler for 11.0 ......................................................................... Changes to the C Compiler for 11.0 ............................................................................. Changes to the Code Generator for 11.0 ...................................................................... Changes to the Compiler Tools for 11.0 ....................................................................... Changes to the C/C++ Libraries for 11.0 ..................................................................... Changes to the DOS Graphics Library for 11.0 ........................................................... Changes in Microsoft Foundation Classes Support for 11.0 ........................................ Changes in Microsoft Win32 SDK Support for 11.0 ................................................... Changes in Blue Skys Visual Programmer for 11.0 .................................................... 6.16 Changes in 10.6 that may Require Recompilation ........................................................... 6.17 Major Differences from Version 10.5 .............................................................................. Windows 95 Help File Format ..................................................................................... Changes to the C++ Compiler in 10.6 .......................................................................... Changes to the C Compiler in 10.6 ............................................................................... Changes to the C Library in 10.6 .................................................................................. Changes in Microsoft Foundation Classes Support for 10.6 ........................................ Changes to the Image Editor in 10.6 ............................................................................ Changes to the Dialog Editor in 10.6 ........................................................................... Changes to the Resource Editor in 10.6 ........................................................................ Changes to the Resource Compiler in 10.6 .................................................................. 6.18 Major Differences from Version 10.0 .............................................................................. Changes in 10.5 that may Require Recompilation ....................................................... 6.19 Major Differences from Version 10.0 LA ....................................................................... 6.20 Major Differences from Watcom C9.5 /386 .................................................................... Items No Longer Supported ......................................................................................... Changes in 10.0 that may Require Recompilation ....................................................... 6.21 Major Differences from Watcom C9.01 /386 .................................................................. Changes that may Require Recompilation ................................................................... 6.22 Major Differences from Watcom C9.0 /386 .................................................................... Command Line Options added to Watcom C9.0 /386 .................................................. 6.23 Major Differences from Watcom C8.5 /386 .................................................................... Command Line Options added to Watcom C8.5 /386 .................................................. 6.24 Major Differences from Watcom C8.0 /386 .................................................................... Command Line Options added to Watcom C8.0 /386 .................................................. 6.25 Major Differences from Watcom C7.0 /386 .................................................................... Protected-mode Compiler and Linker .......................................................................... 39 41 45 45 47 47 49 52 55 56 58 61 62 62 62 63 64 65 65 66 67 67 67 67 67 67 67 68 68 68 69 69 69 69 69 70 80 80 80 81 81 82 82 83 83 83 84 84 85 85 85
iv
Table of Contents
7 Sybase Open Watcom Public License .............................................................................................. 8 Trouble-Shooting .............................................................................................................................. 8.1 Win-OS/2 and OS/2 Specific ............................................................................................. 87 93 94
vi
Host Platforms DOS (command line) 32-bit OS/2 (IDE and command line) Windows 3.x (IDE) Windows 95/98/Me (IDE and command line) Windows NT/2000/XP (IDE and command line) 16-bit Target Platforms DOS Windows 3.x OS/2 1.x
Chapter 1
32-bit Target Platforms Extended DOS Win32s Windows 95/98/Me Windows NT/2000/XP 32-bit OS/2 Novell NLMs Cross-Platform Development Tools The core tools in the package permit cross-platform development that allows developers to exploit the advanced features of todays popular 32-bit operating systems, including Windows 95/98/Me, Windows NT/2000/XP, and OS/2. Cross-platform support allows you to develop on a host development environment for execution on a different target system. Multi-Platform Debugger The new debugger advances developer productivity. New features include redesigned interface, ability to set breakpoints on nested function calls, improved C++ and DLL debugging, reverse execution, and configurable interface. Graphical versions of the debugger are available under Windows 3.x, Windows 95/98/Me, Windows NT/2000/XP, and 32-bit OS/2. Character versions of the debugger are available under DOS, Windows 3.x, Windows NT/2000/XP, and 32-bit OS/2. For VIDEO fans, we have kept the command line compatibility from the original debugger. Class Browser The Browser lets you visually navigate the object hierarchies, functions, variable types, and constants of your C/C++ application. Performance Analysis The Open Watcom Execution Sampler and Open Watcom Execution Profiler are performance analysis tools that locate heavily used sections of code so that you may focus your efforts on these areas and improve your applications performance. Editor The Open Watcom Editor is a context sensitive source editor, integrated into the Windows 3.x, Windows 95/98/Me and Windows NT/2000/XP version of the IDE. Graphical Development Tools Open Watcom C/C++ includes a suite of graphical development tools to aid development of Windows 3.x, Windows 95/98/Me and Windows NT/2000/XP applications. The development tools include: Resource Editors Enable you to create resources for your 16-bit and 32-bit Windows applications. For 32-bit OS/2 PM development, Open Watcom C/C++ interoperates with IBMs OS/2 Developers Toolkit (available from IBM). These tools have been seamlessly integrated into the IDE. The resource compiler allows you to incorporate these resources into your application.
Resource Compiler Produces a compiled resource file from a source file. Zoom Heap Walker Spy Magnifies selected sections of your screen. Displays memory usage for testing and debugging purposes. Monitors messages passed between your application and Windows.
Assembler An assembler is included in the package. It is compatible with a subset of the Microsoft macro assembler (MASM). C++ Class Libraries Open Watcom C/C++ includes container and stream class libraries. Royalty-free 32-bit DOS Extender Open Watcom C/C++ includes the DOS/4GW 32-bit DOS extender by Tenberry Software with royalty-free run-time and virtual memory support up to 32MB. Support for wide range of DOS Extenders Open Watcom C/C++ allows you to develop and debug applications based on the following DOS extender technology: CauseWay DOS Extender, Tenberry Softwares DOS/4G and Phar Laps TNT DOS Extender. You can also develop applications using DOS/32A and FlashTeks DOS Extender but, currently, there is no support for debugging these applications. Sample programs and applications Open Watcom C/C++ includes a large set of sample applications to demonstrate the integrated development environment.
Chapter 1
World Wide Web You can also submit bug reports or enhancement requests through the Open Watcom bug tracking system at http://bugzilla.openwatcom.org/.
Suggested Reading
There are a number of good books and references that can help you answer your questions. Following is a list of some of the books and documents we feel might be helpful. This is by no means an exhaustive list. Contact your local bookstore for additional information.
C Programmers
C++ Programmers
C++ Primer, 2nd Edition Stanley B. Lippman; Addison-Wesley Publishing Company, 1991. Teach Yourself C++ in 21 Days Jesse Liberty; Sams Publishing, 1994.
DOS Developers
PC Interrupts, Second Edition Ralf Brown and Jim Kyle; Addison-Wesley Publishing Company, 1994. Relocatable Object Module Format Specification, V1.1 The Tool Interface Standards (TIS) OMF specification can be obtained from the Open Watcom website. Here is the URL.
http://www.openwatcom.org/ftp/devel/docs/omf.pdf
This file contains a PDF version of the TIS OMF V1.1 specification.
OS/2 Developers
The Design of OS/2 H.M. Deitel and M.S. Kogan; Addison-Wesley Publishing Company, 1992. OS/2 Warp Unleashed, Deluxe Edition David Moskowitz and David Kerr, et al; Sams Publishing, 1995.
2 Installation
The package contains the following components: Open Watcom C/C++ CD-ROM This manual
Chapter 2
If you are installing only one of the Open Watcom C/C++ or Open Watcom FORTRAN 77 products and you have an older version of the other product, we do NOT recommend that you install the new product into the same directory as the old product. The Open Watcom C/C++ and Open Watcom FORTRAN 77 products are compatible at the same version number. However, the Open Watcom C/C++ and Open Watcom FORTRAN 77 products are usually NOT compatible across different version numbers. If this is the case, care must be exercised when switching between use of the two products. Environment variables such as PATH and WATCOM must be modified and/or corrected. System files such as CONFIG.SYS and SYSTEM.INI must be modified and/or corrected. If you are installing both Open Watcom C/C++ 1.9 and Open Watcom FORTRAN 77 1.9, we recommend that you install both products under the same directory. This will eliminate duplication of files and, as a result, reduce the total required disk space. The two products share the use of certain environment variables which point to the installation directory. If separate installation directories are used, problems will arise. When you install Open Watcom C/C++ and Open Watcom FORTRAN 77 in the same directory, you should not deselect any options when running the second installation; otherwise the second products install may remove files that were installed (and are required) by the first products install. This isnt an issue if you only have one of Open Watcom C/C++ or Open Watcom FORTRAN 77. The problem is that Open Watcom C/C++ and Open Watcom FORTRAN 77 dont know about the installation options you have selected for each others product. If you wish to create a backup of your previous version, please do so before installing Open Watcom C/C++ 1.9. If you decide to install Open Watcom C/C++ 1.9 into a different directory than the previously installed version, you will have to manually edit system files (e.g., CONFIG.SYS, AUTOEXEC.BAT, SYSTEM.INI) after the installation process is complete to remove the old version from various environment variables (e.g., PATH, DEVICE=). This is necessary since the path to the new version will appear after the path to the old version. To avoid this extra work, we recommend installing the new version into the same path as the old version. As an example, here are a few of the environment variables and "RUN" directives that are modified/added to the OS/2 CONFIG.SYS file. You should make sure that all references to the older version of the software are removed. Example: LIBPATH=...;D:\WATCOM\BINP\DLL;... SET PATH=...;D:\WATCOM\BINP;D:\WATCOM\BINW;... SET HELP=...;D:\WATCOM\BINP\HELP;... SET BOOKSHELF=...;D:\WATCOM\BINP\HELP;... SET INCLUDE=...;D:\WATCOM\H\OS2;D:\WATCOM\H; SET WATCOM=D:\WATCOM SET EDPATH=D:\WATCOM\EDDAT RUN=D:\WATCOM\BINP\NMPBIND.EXE You may wish to run Open Watcom C/C++ under more than one operating system on the same personal computer. For every operating system that you use, simply start up the operating system and run the corresponding install procedure. If you run the Windows 3.x installation procedure, you do not need to run the DOS installation procedure also. If you plan to use Win-OS/2 as a development platform under OS/2, you must run the Windows 3.1 install program (selecting Windows 3.1 host support).
Installation
Place the CD-ROM disk in your CD-ROM drive. Select one of the following procedures depending on the host operating system that you are currently running. Below, substitute the CD-ROM drive specification for "x:". DOS Enter the following command: x:\setup Windows 3.x Start Windows 3.x and choose Run from the File menu of the Program Manager. Enter the following command: x:\setup Windows 95/98/Me Choose Run from the Start menu and enter the following command: x:\setup Windows NT/2000/XP Log on to an account that is a member of the "Administrator" group so that you have sufficient rights to modify the system environment. Choose Run from the File menu of the Program Manager. Enter the following command: x:\setup OS/2 Start an OS/2 session and enter the following command: x:\install
AUTOEXEC.NEW
Chapter 2
CHANGES.ENV Changes required for the Windows NT/2000/XP environment
2.
6.
2.
10
Installation
SET OLD_ DEL_ DIR=%DELDIR% SET DELDIR= DETACH C:\WATCOM\BINP\BATSERV.EXE SET DELDIR=%OLD_ DEL_ DIR% SET OLD_ DEL_ DIR= 3. If you plan to use the Named Pipe Remote Debugging support of the Open Watcom Debugger then the NMPSERV.EXE. program must be running. It may be started during OS/2 initialization via a "RUN=" statement in your CONFIG.SYS file or manually as needed through the DETACH command.
11
Chapter 2
12
3.1 Outline
Open Watcoms Integrated Development Environment (IDE) manages the files and tools that a programmer uses when developing a project. This includes all the source files, include files, libraries, compiler(s), linkers, preprocessors, etc. that one uses. The IDE has a graphical interface that makes it easy to visualize the make-up of a project. A single IDE session shows a project. If the project consists of a number of components, such as two executables and one library, these are each shown as target windows in the project window. Each target window shows the files that are needed to construct the target and is associated via its filename extension with a rule that describes the construction mechanism. For example, a filename with the extension ".EXE" may be associated with the rule for constructing 32-bit Windows executables, or a filename with the extension ".LIB" may be associated with the rule for constructing static libraries. Different projects can refer to the same target. If they do, the target is shared and can be manipulated via either project, with changes made through one affecting the other. The IDE itself is a collection of programs that manages the various files and tools used to create the target libraries and executables. It creates makefile(s) from the information in the target descriptions and invokes Open Watcom Make to construct the targets themselves. A configuration file contains built-in knowledge of the Open Watcom compilers, editors, Profiler, and Browser, as well as all their switches.
Outline
13
Chapter 3
Defining a Project
In this tutorial, you will be creating a new project called KITCHEN. Here are the steps required to accomplish this task. 1. Define a new project by pulling down the File menu and selecting the New Project... item. You can also define a new project by clicking on the "Create a new project" icon on the toolbar. A choice of different sample project directories is available. Assuming that you installed the Open Watcom C/C++ software in the \WATCOM directory, you will find the sample project directories in the following directory: \WATCOM\SAMPLES\IDE For purposes of this tutorial, we recommend that you select one of the following project directories:
2.
14
WIN386
WIN32
OS2
Thus the target that we refer to below should be one of WIN, WIN386, WIN32, or OS2 depending on your selection. The tutorial uses the WIN32 example for illustrative purposes. You will find some minor variations from your selected target environment. When asked for a project name, you can do one of two things: 1. enter the following pathname: d:[path]\SAMPLES\IDE\target\KITCHEN where d:[path] is the drive and path where you installed the Open Watcom software, or 2. use the file browser to select the following directory: d:[path]\SAMPLES\IDE\target and specify the filename kitchen.
Figure 2. Creating a new project Press the Enter key or click on OK (OPEN). The project description will be stored in this file and the IDE will set the current working directory to the specified path during your session. 3. You will be prompted for a target name. Since we will be attaching pre-defined targets, just click the Browse button when prompted for the target name. Select the "draw" target file (it will be one of draw16.tgt, draw.tgt, draw32.tgt, drawos2.tgt depending on your selection of target).
15
Chapter 3
Figure 3. Attaching existing targets Press the Enter key or click on OK (OPEN). 4. You can ignore the settings displayed for Target Environment and Image Type since the target definition already exists (we created it for you). The settings are important when you are defining a new target (i.e., one that was not predefined).
Figure 4. Selecting a target type Press the Enter key or click on OK. A target window is created in the project window for the "draw" target. This window contains all of the files associated with the target. You can click on any of the "Folder" icons to hide or un-hide all files with a particular extension. For example, you may wish to un-hide all the files with a .bmp extension by clicking on the folder icon associated with bitmap files.
16
3.
4.
A target window is created in the project window for the button target.
Making a Target
Open Watcoms IDE will automatically generate the sequence of steps required to build or "make" each of the targets in a project. Note that the targets in a project can be made individually or collectively. To make the button.lib target, do the following. 1. Click on the window of the target you wish to make. In this case, click on the button.lib target window. Pull down the Targets menu and select the Make item (you can also do this by clicking on the "Make the current target" icon on the toolbar, or by right-clicking on the target and selecting the Make item from the pop-up menu).
2.
The IDE will now construct a makefile based on its knowledge of the target and construction rules, and then invoke the make utility to create the target, in this case button.lib. The output of this procedure is displayed in the Log window.
17
Chapter 3
18
Figure 6. The kitchen demo The demo you have created is a simple three dimensional drawing of a kitchen. By using either the icons on the toolbar or the menus you can rotate the picture left, right, up, and down, make the picture brighter or dimmer, move the picture closer or farther away, and increase or decrease the amount of contrast (this latter feature is found in the "Lighting" menu). Choose Exit from the File menu to exit the demo program when you are finished.
Smart Editing
The IDE recognizes the type of file you wish to edit, and invokes the appropriate editor for the task. To edit a file, you either double-click on it or select it and click the "Edit" icon on the toolbar. Files with a .c, .cpp, .h, .hpp, .for, .asm or .rc extension are edited with a text editor; files with a .bmp, .ico, or .cur extension are edited with the Image Editor; files with a .dlg or .res extension are edited with the Resource Editor.
19
Chapter 3
Figure 7. The Open Watcom Editor for Windows Now we will edit one of the source files and introduce an error into the application. 1. 2. Double-click on the "draw" source file (i.e., draw???.c) to load the source file into the editor. Scroll down to line 227 using the keyboard or mouse. You can also pull down the Edit menu, select Goto Line..., and enter 227. The Open Watcom Editor makes full use of colors and fonts to achieve syntax highlighting. File templates for C, C++, and FORTRAN files are defined to assist you in distinguishing the components of your code. Pull down the Options menu and select the Colors item. Click on a color from the palette, drag it to the word if on line 218, and release it. All keywords are now displayed in the chosen color. Drag a different color to a comment line (line 225) and all comments will display in that color. Similarly, you can select the Fonts item from the Options menu, select a font style and size, and drag it to your source file. Close the Fonts and Colors dialog by double-clicking in the upper left hand corner. You can now save this color and font configuration for all .cpp files by pulling down the Options menu, selecting the General..., item and clicking next to Save configuration on exit in the "Features" box. Press Enter or click on OK. Now, to introduce an error into the application, replace the line #if 0 with #if 1. Save your changes by clicking on the "Write the current file to disk" icon or select Save from the File menu. Return to the IDE (by clicking on it if it is visible on your screen, or by using Alt-Tab), re-make your project, and run it. A fault occurs in your application, so the next step is to track down the problem using the Open Watcom Debugger.
3. 4.
5.
6. 7.
8.
20
Figure 8. Setting compiler switches 3. To invoke the debugger, pull down the Targets menu and choose the Debug item or select the "Debug the current target" icon from the toolbar.
The Open Watcom Debugger is designed to be as convenient and intuitive as possible, while at the same time providing a comprehensive and flexible environment for serious debugging. You can configure your environment to display exactly the information you require to be most productive. Among the windows available are source and assembly, modules, functions, calls, threads, images, watches, locals, globals, file variables, registers, 80x87 FPU, stack, I/O ports, memory display, and a log window. You can step through your source using the keys or icons on the toolbar. Execute one line at a time by stepping over calls or stepping into calls, or execute until the current function returns. Right-mouse button functionality gives context-sensitive pop-up menus.
21
Chapter 3
Figure 9. The Open Watcom Debugger We know that a fault has occurred in draw???.exe, so we will run the application and examine the state of the program when the fault occurs. 1. Click on the "go!" icon on the toolbar to begin execution of the program. The exception occurs and the source window shows the line *pwidth = bitmap.bmWidth + 5; in the function button_ size as the last line executed before the exception. Examining the Locals window you will see that pwidth is a NULL pointer, hence the exception. 2. We can now move up the call stack by clicking on the "Move up the call stack" icon on the toolbar (red up arrow) to follow the programs execution. On the previous line, we see button_ size is called from add_ button. Moving up the call stack again, we see add_ button is called with NULL as its fifth parameter. An artificial error has been introduced for the purposes of this tutorial. It is located several lines back in the source file. By replacing the line #if 1 with #if 0 we can bypass this error. Right-click on the line #if 1 and select Show, then Line... from the pop-up menus to see the line number which must be corrected, then exit the debugger. Double-click on draw???.c to load the source file into the editor. Scroll down to line 227 using the keyboard or mouse, or pull down the Edit menu, select Goto Line..., and enter 227.
3.
4. 5.
22
7.
8.
Figure 10. The Open Watcom Browser 1. Right click on furnitu.cpp, then select Source options from the pop-up menus. Select C++ Compiler Switches from the sub-menu. Go to the 6. Debugging Switches category by selecting it from the drop-down list box or by scrolling through the categories using the >> button. 3. 4. Select Emit Browser information [-db] and click on OK. Click the "Make all targets in the project" icon to re-make the project. The compiler will emit Browser information for furnitu.cpp in a file called draw???.dbr. Now you are ready to browse the targets source.
2.
23
Chapter 3
5. Pull down the Targets menu and select Browse, or click the "Browse the current target" icon on the toolbar. The inheritance tree for the target is displayed. To view details on any particular class, double-click on the item for information such as the location of the class definition, the private, public, and protected functions of the class, and the class inheritance. Branches of the inheritance tree can be collapsed and expanded. A variety of tools are available to help you navigate your C++ source. Double-click on the table class. Double-click on the function top_ and_ four_ legs() to see the details on this function. Select the variable tabletop, pull down the Detail menu, and select the Goto Definition... item. The Editor is invoked, loading the file furnitu.cpp which contains the definition of top_ and_ four_ legs. Next we will make some changes to furnitu.cpp in order to change the color of the tabletop. Scroll down to line 143 using the keyboard or mouse, or pull down the Edit menu, select Goto Line..., and enter 143
6.
7. 8.
9.
10. Replace the line tabletop->rgb(0,255,255); with tabletop->black(); 11. Save your changes by clicking on the "Write the current file to disk" icon or selecting Save from the File menu. 12. Shut down the Browser before re-making the project. 13. Return to the IDE (by clicking on it if it is visible on your screen, or by using Alt-Tab). 14. Click the "Make all targets in the project" icon to re-make the project.
Correcting an Error
An error is encountered during the make and error message(s) appear in the log window. Additional information on the error is available by selecting the error, pulling down the Log menu and selecting the Help on Message item. 1. Double-click on the error message
furnitu.cpp (132): Error! E029: (col 15) symbol black has not been declared.
The offending source file ( furnitu.cpp) is loaded into the Editor and the cursor is positioned at the line which caused the error. Apparently, black has not been defined as a color. 2. 3. Restart the Browser. Double-click on color in the Inheritance window to see the member functions of the class color. Among our choices are blue(), green(), and red().
24
Editing a Bitmap
You can edit bitmaps, icons, or cursors associated with your project using Open Watcoms Image Editor. Double-click on a file with a .bmp, .ico, or .cur extension and the file is loaded into the Image Editor. The editor has many features to design your images, including resizing, rotation, shifting, and a utility to take a "snapshot" of another image and import it.
Figure 11. The Open Watcom Image Editor Suppose you wanted to change the color of the right-arrow icon in your application. 1. If the "Folder" icon next to .bmp is closed, click on it to restore all the files with a .bmp extension to the file list. Scroll the window until the file right.bmp is visible.
2.
25
Chapter 3
3. 4. 5. 6. 7. 8. Double-click on right.bmp in the draw???.exe target window. Select the "Paint Can" icon from the Tool Palette. Select a color from the Color Palette. Click on the arrow. Save your changes using the "Save" icon on the toolbar and exit the Image Editor. Click the "Make all targets in the project" icon to rebuild the project with the change incorporated.
Editing Menus
Next, you will add source files to the list of items that make up draw???.exe. 1. Pull down the Sources menu and select the New Source... item. Note: You can do this either by choosing from the menu bar or by positioning the mouse over the file list area and clicking the right mouse button. The IDE displays a pop-up menu from which you can choose the desired action.
2.
Enter the filename draw.res (or drawos2.res for OS/2). For OS/2, click OK when you have entered the source file name. For all other systems, click on Add when you have entered the source file name and then click on Close. Now we will remove the .rc file from the project so that our changes to the .res file will not be overwritten. When an .rc file is present, the .res file is generated from the .rc file. Right click on draw.rc (or drawos2.rc for OS/2), then select Remove Source from the pop-up menu. Double-click on draw.res (or drawos2.res). The Resource Editor is invoked, displaying all the available resources (in this case, icons, bitmaps, and menus).
3.
4.
26
Figure 12. The Open Watcom Resource Editor 5. 6. Click on "Menu Resources". Double-click on "DrawMenu" in the right-hand box. This will bring up the Menu Editor. The Menu Editor displays the menus defined for the resource DrawMenu. You can specify pop-up menus, menu items and sub-items, text, separators, attributes, break styles, and memory flags.
27
Chapter 3
Figure 13. The Open Watcom Menu Editor 7. 8. 9. Click on MENUITEM "&Dimmer" in the item list window. In the "Item Text" window change the item to &Darker and then click on the "Change" button. Select Update from the File menu or click on the "Update the file with this menu" icon.
10. Exit the Menu Editor. 11. Now, select Save from the File menu or click on the "Save this file" icon and exit the Resource Editor. 12. Click the "Make all targets in the project" icon to re-make the project.
28
3.
4.
5.
29
Chapter 3
30
Tutorial Review
4 Documentation
The following manuals comprise the Open Watcom C/C++ documentation set. When you install the software, portions of the documentation set are provided as on-line help files. Subsequent sections describe how to access this on-line help. The following describes the titles in the Open Watcom C/C++ documentation set. Open Watcom C/C++ Users Guide This manual describes how to use Open Watcom C/C++. It contains an introduction to the compiler and a tutorial section. It also describes compiler options, precompiled header files, libraries, memory models, calling conventions, pragmas, in-line assembly, ROM based applications, and environment variables. Open Watcom C/C++ Tools Users Guide This manual describes the command line oriented tools including the compile and link utility, library manager, object file disassembler, far call optimization tool, assembler, patch utility, strip utility, make utility, and touch utility. Open Watcom Graphical Tools Users Guide This manual describes Open Watcoms Windows and OS/2 graphical tools including the Integrated Development Environment, Browser, Dr. Watcom, Spy, DDE Spy, Image Editor, Resource Editor, Sampler/Profiler, Resource Compiler, Heap Walker, Zoom, and Editor. Open Watcom C/C++ Programmers Guide This manual includes 5 major sections each of which describes operating system specific development issues. The operating systems covered include extended DOS, OS/2, Windows 3.x, Windows NT/2000/XP, Windows 95/98/Me, 32-bit Windows 3.x (using Open Watcoms Supervisor technology) and Novell NLMs. Topics include creating a sample program, operating system specific error messages, and debugging techniques. Open Watcom C Language Reference This manual describes the ISO C programming language and extensions which are supported by Open Watcom C. Open Watcom C Library Reference This manual describe the C and graphics libraries supported by Open Watcom C/C++. Open Watcom C++ Class Library Reference This manual provides a comprehensive reference to the C++ class libraries provided with Open Watcom C/C++. Open Watcom Debugger Users Guide This manual describes the Open Watcom Debugger and discusses advanced debugging techniques. Open Watcom Linker Users Guide This manual describes how to use the Open Watcom Linker to generate executables for
Documentation
31
Chapter 4
target systems such as extended DOS, Windows 3.x, Windows 95/98/Me, Windows NT/2000/XP, OS/2, and Novell NLMs.
The following help files are available: CGUIDE Open Watcom C/C++ Users Guide (excludes C and C++ Diagnostic Messages appendices which are available as separate help files) Open Watcom C Library Reference Open Watcom C Language Reference Open Watcom C/C++ Master Index Open Watcom C++ Class Library Reference Open Watcom Linker Users Guide Open Watcom C/C++ Programmers Guide
C_README Open Watcom C/C++ Getting Started manual RESCOMP Documentation for the Open Watcom Resource Compiler (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom C/C++ Tools Users Guide Open Watcom Debugger Users Guide
TOOLS WD
32
Documentation
WPROF Documentation for the Open Watcom Execution Sampler and Open Watcom Execution Profiler (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Open Watcom C Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide). Documentation for the Open Watcom C++ Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide).
WCCERRS
WPPERRS
Open Watcom C/C++ Tools Help Group Accelerator Editor Help Documentation for the Accelerator Editor (excerpt from the Open Watcom Graphical Tools Users Guide) C Error Messages Documentation for the Open Watcom C Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide) Documentation for the Open Watcom C++ Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide) Open Watcom C Language Reference Open Watcom C Library Reference Open Watcom C++ Class Library Reference The master index for all of the Open Watcom C/C++ on-line help Documentation for the DDE Spy utility (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom Debugger Users Guide Documentation for the Dialogue Editor (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for Dr. Watcom (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Open Watcom Editor (excerpt from the Open Watcom Graphical Tools Users Guide)
C Language Reference C Library Reference C++ Library Reference C/C++ Master Index DDE Spy Help
Editor Help
33
Chapter 4
Heap Walker Help Documentation for the Heap Walker utility (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Interactive Development Environment (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Image Editor (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom Linker Users Guide Documentation for the Menu Editor (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Open Watcom Execution Sampler and Open Watcom Execution Profiler (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom C/C++ Programmers Guide
IDE Help
Profiler Help
Programmers Guide
Resource Compiler Help Documentation for the Resource Compiler (excerpt from the Open Watcom Graphical Tools Users Guide) Resource Editor Help Documentation for the Resource Editor (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Browser (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Spy utility (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the String Editor (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom C/C++ Tools Users Guide Open Watcom C/C++ Users Guide (excludes C and C++ Diagnostic Messages appendices which are available as separate help files) Documentation for the Zoom utility (excerpt from the Open Watcom Graphical Tools Users Guide)
Spy Help
Zoom Help
34
Documentation
C Error Messages Documentation for the C Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide) Documentation for the C++ Diagnostic Messages (excerpt from the Open Watcom C/C++ Users Guide) Open Watcom C Language Reference Open Watcom C Library Reference Open Watcom C++ Class Library Reference The master index for all of the Open Watcom C/C++ on-line help Open Watcom Debugger Users Guide Open Watcom C/C++ Getting Started Documentation for the Interactive Development Environment (excerpt from the Open Watcom Graphical Tools Users Guide) Documentation for the Open Watcom Execution Sampler and Open Watcom Execution Profiler (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom C/C++ Programmers Guide Documentation for the Open Watcom Browser (excerpt from the Open Watcom Graphical Tools Users Guide) Open Watcom C/C++ Tools Users Guide Open Watcom C/C++ Users Guide (excludes C and C++ Diagnostic Messages appendices which are available as separate help files)
C Language Reference C Library Reference C++ Library Reference C/C++ Master Index Debugger Help Getting Started IDE Help
Profiler Help
35
Chapter 4
36
5 Benchmarking Hints
The Open Watcom C/C++ compiler contains many options for controlling the code to be produced. It is impossible to have a certain set of compiler options that will produce the absolute fastest execution times for all possible applications. With that said, we will list the compiler options that we think will give the best execution times for most applications. You may have to experiment with different options to see which combination of options generates the fastest code for your particular application. The recommended options for generating the fastest 16-bit Intel code are: Pentium Pro Pentium 486 386 286 186 8086 /onatx /oh /oi+ /ei /zp8 /6 /fpi87 /fp6 /onatx /oh /oi+ /ei /zp8 /5 /fpi87 /fp5 /onatx /oh /oi+ /ei /zp8 /4 /fpi87 /fp3 /onatx /oh /oi+ /ei /zp8 /3 /fpi87 /fp3 /onatx /oh /oi+ /ei /zp8 /2 /fpi87 /fp2 /onatx /oh /oi+ /ei /zp8 /1 /fpi87 /onatx /oh /oi+ /ei /zp8 /0 /fpi87
The recommended options for generating the fastest 32-bit Intel code are: Pentium Pro Pentium 486 386 /onatx /oh /oi+ /ei /zp8 /6 /fp6 /onatx /oh /oi+ /ei /zp8 /5 /fp5 /onatx /oh /oi+ /ei /zp8 /4 /fp3 /onatx /oh /oi+ /ei /zp8 /3 /fp3
The "oi+" option is for C++ only. Under some circumstances, the "ob" and "ol+" optimizations may also give better performance with 32-bit Intel code. Option "on" causes the compiler to replace floating-point divisions with multiplications by the reciprocal. This generates faster code (multiplication is faster than division), but the result may not be the same because the reciprocal may not be exactly representable. Option "oe" causes small user written functions to be expanded in-line rather than generating a call to the function. Expanding functions in-line can further expose other optimizations that couldnt otherwise be detected if a call was generated to the function. Option "oa" causes the compiler to relax alias checking.
Benchmarking Hints
37
Chapter 5
Option "ot" must be specified to cause the code generator to select code sequences which are faster without any regard to the size of the code. The default is to select code sequences which strike a balance between size and speed. Option "ox" is equivalent to "obmiler" and "s" which causes the compiler/code generator to do branch prediction ("ob"), generate 387 instructions in-line for math functions such as sin, cos, sqrt ("om"), expand intrinsic functions in-line ("oi"), perform loop optimizations ("ol"), expand small user functions in-line ("oe"), reorder instructions to avoid pipeline stalls ("or"), and to not generate any stack overflow checking ("s"). Option "or" is very important for generating fast code for the Pentium and Pentium Pro processors. Option "oh" causes the compiler to attempt repeated optimizations (which can result in longer compiles but more optimal code). Option "oi+" causes the C++ compiler to expand intrinsic functions in-line (just like "oi") but also sets the inline_depth to its maximum (255). By default, inline_depth is 3. The inline_depth can also be changed by using the C++ inline_ depth pragma. Option "ei" causes the compiler to allocate at least an "int" for all enumerated types. Option "zp8" causes all data to be aligned on 8 byte boundaries. The default is "zp2" for the 16-bit compiler and "zp8" for 32-bit compiler. If, for example, "zp1" packing was specified then this would pack all data which would reduce the amount of data memory required but would require extra clock cycles to access data that is not on an appropriate boundary. Options "0", "1", "2", "3", "4", "5" and "6" emit Intel code sequences optimized for processor-specific instruction set features and timings. For 16-bit Intel applications, the use of these options may limit the range of systems on which the application will run but there are execution performance improvements. Options "fp2", "fp3", "fp5" and "fp6" emit Intel floating-point operations targetted at specific features of the math coprocessor in the Intel series. For 16-bit Intel applications, the use of these options may limit the range of systems on which the application will run but there are execution performance improvements. Option "fpi87" causes in-line Intel 80x87 numeric data processor instructions to be generated into the object code for floating-point operations. Floating-point instruction emulation is not included so as to obtain the best floating-point performance in 16-bit Intel applications. For 32-bit Intel applications, the use of the "fp5" option will give good performance on the Intel Pentium but less than optimal performance on the 386 and 486. The use of the "5" option will give good performance on the Pentium and minimal, if any, impact on the 386 and 486. Thus, the following set of options gives good overall performance for the 386, 486 and Pentium processors. /onatx /oh /oi+ /ei /zp8 /5 /fp3
38
Benchmarking Hints
39
Chapter 6
The code generator now supports constant folding of 64-bit integer modulo operations. The code generator no longer mishandles floating-point comparisons where one operand is a variable of type float and the other operand is a constant of type double or long double. The code generator no longer produces incorrect code when a constant expression of type float (e.g., 1.0f + 1.0f) is passed as an argument to a function which takes a float argument. The code generator now makes more accurate decision when choosing whether a multiplication by a constant should be replaced by a sequence of shifts and additions. Results depend on target CPU type. The 386 code generator now produces a CDQ instruction except when targeting a Pentium and optimizing for speed, when a MOV/SAR sequence is emitted as previously when converting a signed 32-bit integer to 64-bit. The code generator no longer emits redundant CS segment overrides when creating calls to symbols imported from DLLs. The Win32 API headers and import libraries have been updated to support the new interfaces in Windows 7. Support for 16-bit OLE 2.0 has been added. Support for RDOS targets has been added. Support for ZDOS targets has been added to the linker. The floating-point exception handler for 16-bit DOS no longer crashes if the user signal handler modified DS. The _floodfill() graphics library function now works correctly again. The library no longer leaks memory when a thread created by _beginthread() terminates. The %Lf format specifier (and related format specifiers) used with printf family functions now works. The library now contains _fseeki64 and _ftelli64 functions to handle 64-bit file offset pointer for streams. The library implementations of _lseeki64, _telli64, _fileleni64, _(w)stati64, _(w)findfirsti64, _(w)findnexti64 on OS/2 now properly use 64-bit file sizes and offsets. The library implementations of puts and putws now correctly return EOF if they fail DOS long file name (LFN) support has been added (new doslfn??.lib model specific libraries contain DOS LFN version of appropriate modules). By default DOS LFN support is enabled. It can be switch off by setup LFN=N environment variable. The wasm assembler now implements support for Turbo Assembler compatible IDEAL mode. The -zcm option may be used to select this feature. The assembler now supports built-in @code and @data symbols.
40
41
Chapter 6
The C compiler now adds location information about enumerated symbols in appropriate diagnostics. The C compiler has been improved with respect to the handling of near/far pointers, especially when converting or comparing pointers and integers of different sizes. The C compiler now properly recognizes functions that do not return, such as longjmp(), and correctly diagnoses control flow issues such as unreachable code or missing return statements. The C compiler now supports a #pragma alias. This pragma emits alias records into the object file for processing by the linker. The C compiler now has larger capacity and can compile some complex source files that previously caused out of memory errors (E1064). The C compiler now always warns about unprototyped functions (W131). Previously, some forgivable instances of missing prototypes were undiagnosed by default, which caused users to write non-portable code usually by accident. Warning W139 (Divisor for modulo or division operation is zero) has been added to the C compiler. This warning is triggered whenever the right operand of an integer division or modulo operation is a constant expression with the value of zero. The handling of pragma aux is now correct in cases where code is emitted and a function body already exists for the corresponding symbolic name. Various fixes to the handling of the include_alias pragma have been made. The C and C++ compilers now have diagnostics for meaningless comparison of 64-bit and bit-field operands. The C and C++ compilers now have conversion tables from CP=1250,1252 (Latin-2,1 for Windows ANSI) to Unicode to support Windows programming. The C++ compiler now supports the explicit specification of function template arguments. For example: f<T>(). The C++ compiler now uses lazy instantiation for class templates and template members. Only the members actually used are instantiated. The C++ compiler now allows member templates to be defined outside their class. Numerous bugs in the C++ compiler have been fixed. The C++ compiler allows a class declaration with modifiers to have those modifiers propagate into the class definition. When -SH switch is used with the Fortran compiler, the default size of an integer constant is now INTEGER*2. The Fortran compiler no longer crashes when equivalencing common/global with automatics.
42
43
Chapter 6
The DOS real-mode trap file (std.trp) now correctly displays high parts of 32-bit registers on 386+ CPUs. Previously, the high parts were always displayed as zeros. WLIB now has a new -pa option to set up library page size automatically to optimal size. WLIB now handles COFF import libraries more correctly. WCL now properly handles the -fd and -fm options without the file name specified. WASM now handles EXTERNDEF directives properly; an EXTDEF record is created only if the symbol is actually referenced. WASM now handles the auto-dependency filename properly. WASM now implicitly creates the __UNIX__ macro for the BSD target as it has for LINUX and QNX. The internal version numbers for WASM and WMAKE are now compatible with that used by the C and C++ compilers. Specifically the macro __WASM__ has the value 1280 for WASM and the macro __VERSION__ has the value 1280 for WMAKE. The 32-bit DOS WD and WPROF can now be used with DOS/4G 2.x. The DOS4GOPTIONS settings are no longer exported. Users may still override the defaults by supplying their own wd.ini and wprof.ini, respectively. These files must be in the appropriate format for the DOS/4G version used. Note that this does not affect DOS/4GW users. WLINK now handles offsets and groups larger than 64 KB for 32 bit code and 16 bit targets. WLINK now ignores fixup displacement when the target relocation is absolute. This is required for compatibility with object files generated by MASM 5.1. WLINK now properly handles the alignment of the last segment in a group if the last segment fragment is blank. WLINK can now use the WLINK_LNK environment variable to override the default directive file name (wlink.lnk). If the specified file isnt found then default file is used as usual. WLINK now properly emits segments overlapped by groups to output file. WLINK now properly handles imported symbols that are locally defined with the dllimport specifier in PE formatted files. WLINK DLL was renamed from wlink.dll to wlinkd.dll. It requires to correct wmake directive "!loaddll" to use this new name if it is used in makefile. WRC on Far-Eastern NT-based systems now honors the DBCS encoding specified on the command line. The text editor now supports syntax highlighting for resource files. The Fgrep dialog box in graphical editor now has a browse button to display the standard browse for folder dialog box on versions of Windows that support it.
44
45
Chapter 6
The code generator no longer incorrectly optimizes out conditionals. The problem only occurred in very rare situations and probably only when doubles were being compared. A long-standing problem with use of certain 64-bit constants as results of ternary operators has been fixed. The C++ compilers now has a workaround for bugzilla bug #63 (http://bugzilla.openwatcom.org/show_bug.cgi?id=63). The compiler now generates an error message referring to the bug entry rather than crashing. The LIBC and CLIB thin netware libraries have been added to the distribution as experimental. 32-bit DOS executables now correctly pass environment to child processes started through the spawn family of functions. Previous incorrect behavior was introduced in version 1.6. In the NetWare libraries, __get_stdout with __get_std_stream was causing an infinite recursion. This has been fixed. Fixed 8087 emulator/mathlib 80-bit real multiplication if one operator is zero and second is a power of two. The _outgtext() function in graph.lib no longer fails on 32-bit targets. The Win32 stat() function now returns correct results when it tries to access a file with given name and the directory containing that file also contained a subdirectory with the same name. The debugger now supports a "No Source" toggle (right mouse click menu) in the assembly code window to switch on/off associated source code. The debugger no longer crashes when tracing F77 programs that use variable-size arrays. This only applies to DWARF debugging information (which is used by default). The debugger now correctly displays multi-dimensional Fortran arrays when DWARF debug information format is used (which is used by default). The debugger can now display [partial] strings in Fortran code when the string length exceeds the debuggers internal limit. The internal limit has also been increased from 512 to 1024 characters. The resource compiler now properly copies non-resident name table when processing LX executables. The console version of vi for Win32 no longer quits after Ctrl+Left is pressed followed by any other key. WCL now correctly takes options from the environment when there is more then one file to compile. The linker now supports a MIXED1632 option to allow mixing of 16- and 32-bit logical segments into a single physical segment in OS/2 LX/LE executables. The linker now supports a NOSTUB option for Windows and OS/2 executable formats. This option causes no DOS stub executable to be written to the output image. The installer now allows you to disable creating program groups or modifying the startup environment using the /np and /ns switches.
46
47
Chapter 6
The code generator now correctly const folds 64-bit right shifts. The code generator now properly converts between far pointers and 64-bit integers. Attempts to convert a 48-bit far pointer to 64-bit integer no longer cause a crash. The code generator has been modified to slightly decrease code size when optimizing for size (-os). The non-standard alloca.h header has been added for compatibility with other compilers. The strftime() library function has been extended to support date formats introduced in C99. The file pointer type used with lseek() and tell() has been changed to off_t (from long) for compatibility with POSIX. The 386 versions of _clear87() and _status87() functions have been modified to use the no-wait form of FPU control instructions. This allows these functions to be used in exception handlers when there are pending unmasked floating-point exceptions. The 16-bit 8087 emulator has been fixed to correctly evaluate multiplies as infinity instead of zero in rare overflow situations. The resource compiler (wrc) has been fixed to store long integer constants as 32-bit quantities in RCDATA or user data resource statements. This behavior applies to Win16, Win32, and OS/2 targets. Integers without the L suffix are stored as 16-bit and potentially truncated. The OS/2 specific part of the resource compiler has been corrected to process RCDATA statements properly. The assembler (wasm) now supports external absolute symbols. The SIZE, SIZEOF, LENGTH, and LENGTHOF operators have been corrected for structures. Classification of privileged instructions in the assembler has been updated to match MASM. The assembler now evaluates expressions in return instructions correctly. Previously, code such as ret 28+4 would be sometimes erroneously assembled as ret 28 instead of ret 32. The linker has been changed to only recognize segments of class STACK as stack segment. Previously, any segment with class name ending with STACK (eg. FSTACK) was recognized. Several minor problems related to creating DOS executables have been fixed in the linker. The RUNTIME linker directive has been extended to allow ELF ABI type and version specification. This functionality is similar to the brandelf utility. See the Linker Guide for details. The wmake utility has been modified such that in native wmake mode, a symbolic target with no command list is always considered to have had its command list executed. That will cause any targets that are dependent on this symbolic target to be considered out of date. The Win32 trap file is now able to determine the full pathname of debuggees loaded DLLs. This may ease debugging in some cases as the debugger will be more likely to find debugging information for DLLs. The Win16 debugger trap file (std.dll) has been modified to allow 16-bit wdw to run on Windows NT platforms without reporting a spurious error message on exit.
48
49
Chapter 6
New warning W137, "Extern function fn redeclared as static", has been added to the C compiler. Existing error E1072, "Storage class disagrees with previous definition of symbol" has been extended to cover redefinitions from extern to static and not only from static to extern. Changing the linkage of a symbol invokes undefined behavior according to ISO C. New warning W138, "No newline at end of file", has been added to the C compiler. It is emitted if no line terminator character was found before the end of a source file. Such files do not conform to ISO C. The missing newline character will be automatically inserted; this matches the C++ compiler behavior. Note that missing newlines could previously lead to spurious "#endif matches #if in different source file" warnings. The C compiler has been modified to allow the __export or __declspec(dllexport) modifier on a declaration when earlier declaration exists with no modifier. The updated behavior is compatible with the C++ compiler as well as some compilers from other vendors. In ISO/ANSI mode (-za), the compiler now always warns if it encounters a call to unprototyped function. In extensions mode (default, -ze), this warning (W131) is suppressed if a matching prototype is found later in the source file. Note that the behavior in extensions mode is unchanged from earlier versions. The C compiler now eliminates static functions that are always inlined from the object file (the functions are of course still emitted if their address is taken). The C compiler has been fixed to properly evaluate boolean expressions (especially the ternary operator) where the condition is a 64-bit integer constant. Previously, the high 32 bits were in some cases ignored, which could lead to erroneous results. The C compiler has been modified to properly cast floating-point constants to the specified type. Notably FLT_MIN stored or passed as double is now handled correctly (without spurious precision). Handling of empty macro arguments has been corrected in the C compilers preprocessor. Previously, empty macro arguments could result in invalid tokens in certain cases. The peephole optimizer is now run again after register allocation. This allows the code generator to take advantage of some optimization opportunities that were previously missed. The code generator has been modified to copy DS into ES in __interrupt routine prolog (right after DS was loaded) if the ES register is considered unalterable, ie. in flat model. This may avoid crashes if ES is dereferenced explicitly or implicitly in interrupt handlers, for instance when calling memcpy(). The linker and other tools have been fixed to correctly classify code segments. Previously, code segments could be misclassified as data, which led to incorrect disassembly and generation of debugging information. A performance problem related to emitting debugging information for structures or unions with many members has been corrected in the code generator. The POSIX-defined header libgen.h has been implemented. This includes two functions, basename() and dirname(). The functions btowc(), fwide(), mbsinit(), wctrans(), and towctrans() have been added to the C runtime library. These functions are all related to wide-character and multi-byte support, and were first defined by the ISO C Normative Amendment 1.
50
51
Chapter 6
52
53
Chapter 6
The floating-point to string conversion routines now format values with greater precision. This means that floating-point values printed by C and C++ programs may be slightly different from earlier versions of the runtime libraries (but more accurate). The sleep() function is now declared in unistd.h and its return type has been changed to unsigned int, for compatibility with POSIX. The clock() function now uses millisecond counters (where available) on DOS and Windows, and is no longer susceptible to problems related to TZ changes. The DOS runtime has been tuned to produce smaller executables. C99 functions wmemchr(), wmemcmp(), wmemcpy(), wmemmove(), and wmemset() have been added to the C runtime library. A POSIX compatible getopt() function has been added to the C runtime library. A POSIX compatible mkstemp() function has been added to the C runtime library. BSD compatible safe string copy and concatenation functions, strlcpy() and strlcat(), have been added. Use of these functions is highly recommended over strncpy() and strncat(), because they are safer and much easier to use. New strings.h header has been added for POSIX compatibility, although legacy functions index() and rindex() are not supported. Functions strcasecmp() and strncasecmp() are also declared in string.h for compatibility with other compilers. The C runtime library no longer returns ESPIPE when calling write() on a pipe or device that was opened with O_APPEND flag. The old behavior was not POSIX conforming. Handling of pathnames that include spaces has been improved in the make utility (wmake). The disassembler (wdis) now handles big endian object files on little endian host platforms, and vice versa. Support for MIPS R4000 and SPARC V8 instruction sets has been added to the disassembler. New -zz and -zzo option have been added to the assembler (wasm) for backwards compatibility. See Tools Users Guide for details. Default behavior of inline assembler has changed. The CPU optimization level (-4, -5, -6) now implies the available instruction set: -5 implies MMX and 3DNow!, -6 also implies SSE/SSE2/SSE3. Also note that any CPU setting override now reverts to default at the end of each inline assembly block. 16-bit DOS version of the assembler (wasmr) has been added. This version runs on 8086 and above and requires less memory than the protected mode version. The debugger has been changed to look for support files in directories relative to the debugger executables location. This allows the debugger to be used when no debugger specific environment variables have been set. A problem with stepping into code (F8) right after debuggee was loaded has been fixed in the debugger.
54
55
Chapter 6
56
57
Chapter 6
The OS/2 debuggers now dynamically allocate buffer for the command line, preventing crashes when the command line was over approx. 260 bytes long. The NetWare 5 debugger NLM has been changed to use kernel primitives. Previous version were using legacy semaphores. The make program (wmake) has been sped up very slightly. Also the echo command is now internal and no longer spawns the system command interpreter. The precision of DBL_MAX, DBL_MIN and DBL_EPSILON has been increased; the non-standard variants prefixed with an underscore have been removed. The C99 functions atoll(), lltoa(), ulltoa(), strtoll(), strtoull() and corresponding wide character functions have been added to the C runtime library. The _beginthread() function now consistently returns -1 in case of error on all platforms. The stdaux and stdprn streams are now only defined on DOS based platforms, ie. DOS, Win16 and Win386. No other platforms support stdaux or stdprn. The assert() macro now prints function name in addition to source file and line number, in accordance with C99. The _heapchk() function will now always perform a consistency check on the heap, where it would previously only check consistency if there had been allocations/frees since last call to _heapchk(). As a consequence, _heapchk() previously did not detect certain instances of heap corruption. [OS/2 32-bit] The default __disallow_single_dgroup() implementation no longer statically links against PMWIN.DLL. This allows DLLs to load on systems where PMWIN.DLL isnt present. [OS/2 32-bit] Re-implemented clock(). The new implementation uses the OS millisecond counter and is hence not susceptible to TZ changes. It is also smaller, faster and more accurate, although it may wrap around earlier than the original implementation. The disassembler (wdis) now correctly processes x86 push 8-bit immediate instructions. The disassembler now correctly processes absolute memory references. All memory references without fixup are now disassembled as ds:[...] or sreg:[...]. Several DirectX Win32 programming samples have been added. Note that a separate DirectX SDK (available from Microsoft) is required to build these sample programs.
58
59
Chapter 6
Several system definitions have been added to wlink: os2_pm (16-bit OS/2 Presentation Manager executable), os2_dll (16-bit OS/2 DLL) and os2v2_dll (32-bit OS/2 DLL). The linker has been fixed to read "AR" style archives produced by third party tools. The linker has been fixed to prevent crashes when linking with COFF files providing uninitialized COMDAT entries Several linker crashes related to ELF object files and executables have been resolved. Updated wlink to call wlib with the -c (case sensitive) option when creating import libraries. This fixes problems with DLLs that export symbols differing only in case. The C runtime library has been optimized to produce smaller executables. The printf() function now supports the "ll" format specifier for "long long" integers. The printf() function has been enhanced to support %b format specifier for bitfields. Execution order of C library termination routines is now better defined to prevent instances where temporary files created through mktemp() could be left behind. [OS/2 32-bit] To prevent crashes, termination code is not run if second instance of a DLL failed to load due to single DGROUP. [OS/2 32-bit] The __grow_handles() function was incorrectly adding n requested handles to existing limit instead of setting the limit to n. [OS/2 32-bit] Fixed a problem with _STACKLOW in multithreaded programs and DLLs. This prevents crashes where Fortran DLLs would run out of stack. [OS/2 16-bit] Fixed default math exception handler which wasnt popping the FP status word off the stack and would therefore crash on exit. The Win32 Image Editor has been enhanced with drag-and-drop support. The IDE has been fixed to properly handle mixed case filenames. The Microsoft compatibility tools (NMAKE, CL) have been fixed to better handle command line arguments. The Dialog Editor (wde) has been fixed to prevent occasional DDE related crashes when run from inside the Resource Editor (wre). The Change font option no longer crashes the GUI debugger (wdw). On OS/2, wdw now intercepts the F10 key instead of passing it on to the system. The code generator now deletes object files if it was interrupted. Previously zero-length invalid object files could be left behind, interfering with make operation. The wasm assembler has been enhanced to generate file dependency information usable by wmake. Numerous minor fixes have been made to wasm.
60
61
Chapter 6
62
Suppose the class was changed as follows: Example: struct S { explicit S(int ); S( char ); }; S v = 1; // OK; S( char ) is called
The fact that S(int) is not considered leaves S(char) as the only way to satisfy the implicit conversion. We have added support for name spaces.
63
Chapter 6
namespace x { // anything that can go in file-scope } namespace { // anything in here is local to your module! } In the above example, you can access names in the namespace "x" by "x::" scoping. Alternatively, you can use the "using namespace x" statement (thereby eliminating the need for "x::" scoping). You can include a part of the namespace into the current scope with the "using x::member" statement. (also eliminating the need for "x::" scoping). 1. Name spaces eliminate the hand mangling of names. For example, instead of prefixing names with a distinguishing string like "XPQ_" (e.g., XPQ_Lookup), you can put the names in a namespace called "XPQ". Name spaces allow for private names in a module. This is most useful for types which are used in a single module. Name spaces encourage the meaningful classification of implementation components. For example, code-generation components might reside in a namespace called "CodeGen".
2. 3.
We have added support for RTTI (Run-Time Type Information). We have added support for the new C++ cast notation. It allows you to use less powerful casts that the all powerful C-style cast and to write more meaningful code. The idea is to eliminate explicit casts by using a more meaningful new-style cast. The new C++ casts are: reinterpret_cast < type-id >(expr) const_cast < type-id >( expr ) static_cast < type-id >( expr ) dynamic_cast < type-id >( expr ) (part of RTTI) We have improved (faster) pre-compiled header support. We have added "long long" (64-bit integer) support in the form of a new __int64 type. The default structure packing was changed from "zp1" to "zp2" in the 16-bit compiler and from "zp1" to "zp8" in the 32-bit compiler. The default type of debugging information that is included in object files is "Dwarf". It used to be "Watcom". A new double-byte string processing option has been added (zkl). When this option is specified, the local or current code page character set is used to decide if the compiler should process strings as if they might contain double-byte characters.
64
65
Chapter 6
nmake cl link lib rc cvtres These programs take the usual Microsoft arguments and translate them, where possible, into equivalent Open Watcom arguments and spawn the equivalent Open Watcom tools. Open Watcom Make now processes Microsoft format makefiles when the "ms" option is used.
66
clock()
67
Chapter 6
68
The clock function accuracy has changed from 100 ticks per second to 1000 ticks per second (i.e., CLOCKS_PER_SEC has changed).
69
Chapter 6
5.
6.
7.
8.
70
9.
We now allow: extern "C" int _ _ cdecl x; It must be extern "C" for _ _ cdecl to take effect since variables have their type mangled into the name for "C++" linkage.
10. In C++, we have removed the warning for "always true/false" expressions if the sub-expressions are constant values. 11. We have added support for: #pragma pack(push,4); #pragma pack(push); #pragma pack(pop) 12. We have added support for: #pragma comment(lib,"mylib.lib") which has the same semantics as: #pragma library( "mylib.lib" ) 13. We have added support for expanding macros in the code_seg/data_seg pragmas:
71
Chapter 6
#define DATA_ SEG_ NAME "MYDATA" #define CODE_ SEG_ NAME "MYCODE" #pragma data_ seg( DATA_ SEG_ NAME ) int x = 3; #pragma code_ seg( CODE_ SEG_ NAME ) int fn() { return x; } 14. We have fixed the 16-bit compiler so that it matches the Microsoft 16-bit C compiler for the following cases: If a pascal function is defined when compiling for Windows 3.x, use the fat Windows 3.x prologue in the function. If a cdecl function is defined when compiling for Windows 3.x, use the fat Windows 3.x prologue in the function. 15. We have fixed the compiler so that #include </dir/file.h> works as expected (it was searching along the INCLUDE path only). 16. In C++, we have fixed a problem where an import was generated in the object file for a virtual function call. This will reduce the size of executables under certain circumstances. 17. In C++, we have removed the prohibition of pointer to array of unknown size declarations. Example: int (*p)[]; 18. In C++, we have fixed the diagnosis of lexical problems during macro expansion to remove spurious warnings. Example: #define stringize( x )
#x
stringize( 2131231236172637126371273612763612731 ) 19. We have corrected the check for too many bytes in #pragma for assembler style aux #pragmas. 20. Undeclared class names in elaborated class specifiers are now declared in the nearest enclosing non-class scope. Undeclared classes are also allowed in arguments now.
72
21. We have fixed unduly harsh restriction on virtual ...-style functions. They are now allowed in single inheritance hierarchies as long as the return type is not changed when the virtual function is overridden. In multiple inheritance hierarchies, an implementation restriction is still present for generating a this adjustment thunk for virtual functions. 22. We have fixed line number information for multi-line statement expressions in some weird cases. 23. We have fixed function template parsing of user-defined conversions that use an uninstantiated class in their operator name. Example: void ack( int ); template <class T> struct S { S( T x ) { ack( x ); } }; template <class T> struct W { operator S<T>(); }; template <class T> W<T>::operator S<T>() { return 0; } 24. We have fixed a compiler problem that caused a linker warning "lazy reference for <virtual-fn> has different default resolutions" in cases where the compiler or programmer optimized virtual function calls to direct calls in modules that also contained virtual calls. Example: T.H struct S { virtual int foo() { return _ _ LINE_ _ ; } }; struct T : S { virtual int foo() { return _ _ LINE_ _ ; } };
73
Chapter 6
T1.CPP #include "t.h" struct Q : T { virtual int foo() { return S::foo() + _ _ LINE_ _ ; } }; void foo( T *p ) { Q y; y.foo(); p->foo(); } T2.CPP #include "t.h" void foo( T *p ); void ack( T *p ) { p->foo(); foo(p); } main() { T q; ack( &q ); } 25. When a class value is returned and is immediately (in the same expression) used to call a member function, the value may not be stored in memory. Work around: introduce a temporary Example: struct S { int v; int member(); }; S foo(); void example( void ) { // foo().member(); S temp = foo(); temp.member(); }
26. Throwing pointers to functions did not work when the size of a function pointer is greater than the size of a data pointer. Work around: place the function pointer in a class and throw the class object. 27. We have fixed default argument processing for const references to an abstract class. The following example would not compile properly:
74
75
Chapter 6
Example: struct S { void foo() const; void bar(); }; void S::foo() const { bar(); this->bar(); } 33. We have fixed output of browser information for instantiated function template typedefs. 34. We have upgraded the C++ parser so that casts and member pointer dereferences can appear on the left hand side of the assignment expression without parentheses. Example: p->*mp = 1; (int&)x = 1; 35. In several cases, when a function return or a construction was immediately dotted in an expression, the generated code was incorrect: Example: struct S { int x; int foo(); }; extern S gorf(); void bar() { gorf().foo(); } The work around was to break the statement in two: Example: S temp = gorf(); temp.foo(); 36. In several cases, when a function return or a construction was immediately addressed in an expression, the generated code was incorrect:
76
extern _ _ declspec(dllimport) int a; // import a from a .DLL extern _ _ declspec(dllimport) int b();//import b from a .DLL struct _ _ declspec(dllimport) I { static int a; member void b(); };
77
Chapter 6
39. The C++ compiler generates better error messages for in-class initializations and pure virtual functions. Example: struct S { static int const a static int const b void foo() = 0; void bar() = 1; virtual void ack() virtual void sam() };
= 0; = 1;
= 0; = 1;
40. We have fixed macro processing code so that the following program compiles correctly. The compiler was not treating "catch" as a keyword after the expansion of "catch_all". Example: #define catch(n) catch(n &exception) #define xall (...) #define catch_ all catch xall main() { try{ } catch_ all{ } } 41. We have fixed a problem where #pragma code_ seg caused a page fault in the compiler when the code_seg was empty. 42. We have fixed a rare problem where a #include of a file that was previously included caused the primary source file to finish up if the CR/LF pair for the line that the #include was on, straddled the C++ compilers internal buffering boundary. 43. We have added support for #pragma message( "message text" ). It outputs a message to stdout when encountered. It is used in Microsoft SDK header files to warn about directly including header files and obsolete files. 44. We have fixed #pragma code_seg/data_seg to properly set the class name of the new segment in the object file. 45. We have a fixed a problem with the -zm -d2 options that caused a compiler fault in some circumstances. 46. We have fixed default library records in .OBJ file so that user libraries are ahead of default compiler libraries in the linker search order. 47. We have fixed handling of intrinsic math functions so that the code generator will treat functions like sqrt as an operator. 48. We have added support for using OS-specific exception handling mechanisms for C++ exception handling during code generation. Enable it with the new -zo option.
78
In the above example, the object files will be included in the order indicated (LIBFILE object files are always included first).
79
Chapter 6
__cdecl
You should not continue to use .cfg files from the Limited Availability version of the compiler. Several new features have been added. Using the old files will cause problems. The C++ compiler calling conventions have changed. Any program that passes a "data only" class or struct as a parameter, or returns a C++ object will need to be recompiled. We recommend that you recompile your application. The C++ compiler now supports the use of the __export, __cdecl, __pascal, __stdcall and __syscall keyword on class definitions. These keywords will affect all members of the defined class.
80
81
Chapter 6
82
zm
83
Chapter 6
Remote debugging over the parallel port using either a "LapLink" cable or a "Flying Dutchman" cable. Remote debugging of PenPoint applications
84
85
Chapter 6
86
87
Chapter 7
such in the header file(s) of such work; and (b) the object code compiled from such Source Code and originally made available by Sybase under this License. 1.8 "Personal Use" means use of Covered Code by an individual solely for his or her personal, private and non-commercial purposes. An individuals use of Covered Code in his or her capacity as an officer, employee, member, independent contractor or agent of a corporation, business or organization (commercial or non-commercial) does not qualify as Personal Use. 1.9 "Source Code" means the human readable form of a program or other work that is suitable for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an executable (object code). 1.10 "You" or "Your" means an individual or a legal entity exercising rights under this License. For legal entities, "You" or "Your" includes any entity which controls, is controlled by, or is under common control with, You, where "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. 2. Permitted Uses; Conditions & Restrictions.Subject to the terms and conditions of this License, Sybase hereby grants You, effective on the date You accept this License and download the Original Code, a world-wide, royalty-free, non-exclusive license, to the extent of Sybases Applicable Patent Rights and copyrights covering the Original Code, to do the following: 2.1 You may use, reproduce, display, perform, modify and distribute Original Code, with or without Modifications, solely for Your internal research and development and/or Personal Use, provided that in each instance: (a) You must retain and reproduce in all copies of Original Code the copyright and other proprietary notices and disclaimers of Sybase as they appear in the Original Code, and keep intact all notices in the Original Code that refer to this License; and (b) You must retain and reproduce a copy of this License with every copy of Source Code of Covered Code and documentation You distribute, and You may not offer or impose any terms on such Source Code that alter or restrict this License or the recipients rights hereunder, except as permitted under Section 6. (c) Whenever reasonably feasible you should include the copy of this License in a click-wrap format, which requires affirmative acceptance by clicking on an "I accept" button or similar mechanism. If a click-wrap format is not included, you must include a statement that any use (including without limitation reproduction, modification or distribution) of the Software, and any other affirmative act that you define, constitutes acceptance of the License, and instructing the user not to use the Covered Code in any manner if the user does not accept all of the terms and conditions of the License. 2.2 You may use, reproduce, display, perform, modify and Deploy Covered Code, provided that in each instance: (a) You must satisfy all the conditions of Section 2.1 with respect to the Source Code of the Covered Code; (b) You must duplicate, to the extent it does not already exist, the notice in Exhibit A in each file of the Source Code of all Your Modifications, and cause the modified files to carry prominent notices stating that You changed the files and the date of any change; (c) You must make Source Code of all Your Deployed Modifications publicly available under the terms of this License, including the license grants set forth in Section 3 below, for as long as you Deploy the Covered Code or twelve (12) months from the date of initial Deployment, whichever is longer. You should
88
89
Chapter 7
8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part pre-release, untested, or not fully tested works. The Covered Code may contain errors that could cause failures or loss of data, and may be incomplete or contain inaccuracies. You expressly acknowledge and agree that use of the Covered Code, or any portion thereof, is at Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND SYBASE AND SYBASES LICENSOR(S) (COLLECTIVELY REFERRED TO AS "SYBASE" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. SYBASE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY SYBASE, A SYBASE AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You acknowledge that the Covered Code is not intended for use in the operation of nuclear facilities, aircraft navigation, communication systems, or air traffic control machines in which case the failure of the Covered Code could lead to death, personal injury, or severe physical or environmental damage. 9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL SYBASE OR ANY CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, CONSEQUENTIAL OR OTHER DAMAGES OF ANY KIND ARISING OUT OF OR RELATING TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF SYBASE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR CONSEQUENTIAL OR OTHER DAMAGES OF ANY KIND, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event shall Sybases or any Contributors total liability to You for all damages (other than as may be required by applicable law) under this License exceed the amount of five hundred dollars ($500.00). 10. Trademarks. This License does not grant any rights to use the trademarks or trade names "Sybase" or any other trademarks or trade names belonging to Sybase (collectively "Sybase Marks") or to any trademark or trade name belonging to any Contributor("Contributor Marks"). No Sybase Marks or Contributor Marks may be used to endorse or promote products derived from the Original Code or Covered Code other than with the prior written consent of Sybase or the Contributor, as applicable. 11. Ownership. Subject to the licenses granted under this License, each Contributor retains all rights, title and interest in and to any Modifications made by such Contributor. Sybase retains all rights, title and interest in and to the Original Code and any Modifications made by or on behalf of Sybase ("Sybase Modifications"), and such Sybase Modifications will not be automatically subject to this License. Sybase may, at its sole discretion, choose to license such Sybase Modifications under this License, or on different terms from those contained in this License or may choose not to license them at all. 12. Termination. 12.1 Termination. This License and the rights granted hereunder will terminate:
90
91
Chapter 7
License. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. 13.7 Entire Agreement; Governing Law. This License constitutes the entire agreement between the parties with respect to the subject matter hereof. This License shall be governed by the laws of the United States and the State of California, except that body of California law concerning conflicts of law. Where You are located in the province of Quebec, Canada, the following clause applies: The parties hereby confirm that they have requested that this License and all related documents be drafted in English. Les parties ont exige que le present contrat et tous les documents connexes soient rediges en anglais. EXHIBIT A.
Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Sybase Open Watcom Public License version 1.0 (the License). You may not use this file except in compliance with the License. BY USING THIS FILE YOU AGREE TO ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is provided with the Original Code and Modifications, and is also available at www.sybase.com/developer/opensource. The Original Code and all software distributed under the License are distributed on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License.
92
8 Trouble-Shooting
This section is intended to provide you with help on some of the common (and not so common) problems that users have encountered when trying to run the software. Symptom: Resolution: The message "Cannot connect to batch spawn server" is displayed. This message occurs when the Open Watcom IDE is trying to connect to the batch server. The batch server is a program that is employed by the Open Watcom IDE to run "makes" in the background. There are several reasons why you may receive this message. Installing Under the Host System and Selecting "Modify System Files" During Install For the IDE to run properly under a particular host operating system, the install program must be run on that system. It is very important to check the "Modify System Files" when running the install on the host platform. Otherwise, changes required in the host systems environment will not be made. If this is the problem, you should re-install under the host environment and select this option. System stability If for some reason the operating system has become unstable, the IDE may have trouble connecting to the batch server. This can happen if you have run a badly behaved application that caused an exception, for example a page fault. If this is the problem, you should shutdown the operating system and reboot. Running Windows 3.1 in Enhanced Mode The IDE requires at least version 3.1 of Windows to be running, in enhanced mode. Windows 3.0 is not supported. Running Third-Party Shell Programs If you run 4DOS.COM or some other shell besides COMMAND.COM, you must change the "BATCHBOX.PIF" file accordingly. You can do this using the standard Windows PIF editor. Running Virus Checkers If you are running Central Points PCTOOLS, VWATCH, or some other virus checker, it may be conflicting with our batch server. To isolate the problem, uninstall the virus checker and see if the IDE works again. 386 Enhanced "Exclusive in Foreground" Option If you go to the Windows Control Panel, "Scheduling Options" of "386 Enhanced", and the "Exclusive in Foreground" checkbox is checked, uncheck it. This causes our batch server to starve under Windows.
Trouble-Shooting
93
Chapter 8
Changes to the SYSTEM.INI File The WDEBUG.386 driver is required to be installed in the [386Enh] section of SYSTEM.INI. This should have been done automatically by the WATCOM install program when the software was installed under the host environment and the "modify system files" option was selected. It has been reported that the line OverlappedIO=on not appear in the SYSTEM.INI file. It appears the users problem was related to conflicts with other devices installed in the SYSTEM.INI file. On its own, the above line does not appear to affect the execution of the IDE. It has been reported that the line NoEMMDriver=ON not appear in the SYSTEM.INI file. It will prevent a link from succeeding in the IDE.
94
Index
3
386 Enhanced 10
D
DDE spy 3 debugger 11 DELDIR environment variable 10 DOS extender 3 DPMI specification 5 Dr. Watcom 3
4
4DOS 10
E A
anti-virus 10 editor 2 Enhanced System Editor 10 environment variables DELDIR 10 PATH 8 WATCOM 8 EPM 10 __export 80
B
batch server 10, 94 BATCHBOX.PIF 10 benchmarking 37 BINMODE 66
F
fastest 16-bit code 37 fastest 32-bit code 37
C G
__cdecl 80 class browser 2 class libraries 3 clock 62, 66-67, 69 clock() 61 CLOCKS_PER_SEC 62, 66-67, 69 COMMAND.COM 10 CONFIG.SYS 11 Control Panel 10 cross-platform 2 GUI tools 2
H
hardware requirements 7 heap walker 2 host platforms supported 1
95
Index
printf() 61 product overview 1 Program Information File 10
I
IDE 10 Image Type 16-17 InDOSPolling 10 INSTALL 9 installation incremental 9 modifications to files 9 multiple operating systems 8 previous version 7 installing Open Watcom C/C++ 7 DOS 9 OS/2 9 Windows 3.x 9 Windows 95/98/Me 9 Windows NT/2000/XP 9 __int64 64-66
R
read-me file 3 resource compiler 2 resource editors 2
S
scanf 66 self-help 3 SETUP 9 software requirements 7 spy 2 stat 55 __stdcall 80 struct stat 55 __syscall 80 SYSTEM.INI 10, 94
N
NMPBIND 11 NoEMMDriver 10, 94
O
OMF specification 5 OPTION NOCASEEX 62 _osver 66 OverlappedIO 10 overview 1
T
Target Environment 16-17 target platforms supported 1 technical support 3-4
U P
UNDELETE 10 __pascal 80 PATH environment variable 8 performance analysis 2 PIF 10 platforms supported 1 printf 66
W
WATCOM environment variable 8
96
Index
WHELP 32 Windows 386 Enhanced 10 Control Panel 10 InDOSPolling 10 NoEMMDriver 10, 94 OverlappedIO 10 SYSTEM.INI 10, 94 _winmajor 66 _winminor 66 _winver 66
Z
zoom 2
97