[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

Chapter 8.

 

Target Settings for Win32/x86



This chapter discusses each of the settings panels that affect code generation for Win32/x86 development. By modifying the settings for the individual items within a panel, you can control the compiler, linker, and other aspects of code generation.

Specific details about how the compiler and linker work for Win32/x86 development, such as compiler pragmas, linker symbols and so forth, is found in "C and C++ for Win32."

The sections in this chapter are:


Target Settings Overview

Each target in a CodeWarrior® project has its own individual settings. These settings control a variety of features, such as compiler options, linker output, error and warning messages, and so forth. These are modified settings through the Target Settings window, where Target is the name of the project's currently selected target. This interface is fully explained in the IDE User Guide.

In brief, the compiler and linker behavior for a particular target is controlled by modifying settings in the appropriate settings panels in the Target Settings window. To open any settings panel, choose Edit > Target Settings, where Target is the current target in the project. Or, click the Target tab in the project window and double-click the target of interest.

The Target Settings window appears, as shown in Figure 8.1.

Target Settings window:

Select the settings panel you wish to examine from the list in the Target Settings Panels area. You can then modify the settings to suit your needs.

When you modify the settings on a panel, you can restore the previous values by clicking Revert. To restore the settings to the factory defaults, click Factory Settings.


TIP

Use project stationery when you create a new project. The stationery has all settings in all panels set to reasonable or default values. To create your own stationery file with your preferred settings, modify a new project to suit your needs, then save it in the stationery folder. See the IDE User Guide for details.



Settings Panels for Win32/x86

This section discusses panels specific to Win32/x86 development, and the purpose and effect of each setting. The panels are:

Settings panels of more general interest are discussed in other CodeWarrior manuals. Table 8.1 lists several panels and where you can find information about them.

Where to find information on other settings panels:

 

Panel
Manual
Access Paths  
IDE User Guide  
Build Extras  
IDE User Guide  
File Mappings  
IDE User Guide  
C/C++ Language  
C Compilers Reference  
C/C++ Warnings  
C Compilers Reference  
Global Optimizations  
IDE User Guide  
Custom Keywords  
IDE User Guide  


Target Settings

The Target Settings window contains a Target Settings panel. The window and the panel, while similarly named, are not the same. The window displays all panels, one at a time. The Target Settings panel is one of those panels.

The Target Settings panel, shown in Figure 8.2, is perhaps the most important panel in the CodeWarrior IDE. This is the panel where you pick your target. When you select a linker in the Target Settings panel, you specify the target operating system and/or chip. The other panels listed in the window will change to reflect your choice.

Because the linker choice affects the visibility of other related panels, you must set your target before you can specify other target-specific options, like compiler and linker settings.

The Target Settings panel is not the same as the x86 Target panel. You specify the target in the Target Settings panel. The x86 Target panel is used to control other target-specific settings.


The items in this panel are:

 

Target Name  
Post-linker  
Linker  
Output directory  
Pre-linker  
Save project entries using relative paths  

The Target Settings panel:

Target Name

Use the Target Name field to set or change the name of a target. When you use the Targets view in the project window, you will see the name that you have set.

The name you set here is not the name of your final output file. It is only the name you assign to the target. The name of the final output file is set in the x86 Target panel.


Linker

Choose a linker from the items listed in the Linker pop-up menu. For Win32/x86, use Win32 x86 Linker.


Pre-linker

Some targets have pre-linkers that perform work on object code before it is linked. There is no pre-linker for Win32/x86 development.


Post-linker

Some targets have post-linkers that perform additional work (such as object code format conversion) on the final executable. There is no post-linker for Win32/x86 development.


Output directory

This is the directory where your final linked output file will be placed. The default location is the directory that contains your project file. Click the Choose button to specify another directory.


Save project entries using relative paths

To add two or more files with the same name to a project, enable this option. When this option is enabled, the IDE includes information about the path used to access the file as well as the file name when it stores information about the file. When searching for a file, the IDE combines access path settings with the path settings it includes for each project entry.

When this option is disabled, the IDE only records information about each project entry's file name. Hence, each project entry must have a unique name. When searching for a file, the IDE only uses Access Paths.


Clear

The Clear button clears the Output Directory choice.


x86 Target

The x86 Target panel, shown in Figure 8.3, is where the name of your final output file is specified.

The settings available in this panel depend on the type of project you are creating.

The x86 Target panel.:

The items in this panel are:

 

Project Type  
Committed Stack Size  
File Name  
Reserved Heap Size  
Base Address  
Committed Heap Size  
Reserved Stack Size  
Generate Import Library  


Project Type

This list-box specifies the type of output file to generate. These types are:


File Name

This field controls the name of the application or library file to be generated.


Base Address

This field specifies the preferred address for loading the application or DLL. The default is 0x00400000.

Applications and DLLs load faster when loaded at the preferred address. However, if the default address is not available, Windows will relocate them to an empty address.


Reserved Stack Size

This field specifies the amount of virtual address space reserved for the stack. The default is 1024 K.


Committed Stack Size

This field specifies the amount of memory actually allocated to the stack on loading. This amount automatically increases as needed during execution, up to the reserved stack size. The default is 4 K.


Reserved Heap Size

This field specifies the amount of virtual address space reserved for the dynamic memory heap. The default is 1024 K.


Committed Heap Size

This field specifies of memory actually allocated to the heap on loading. This amount automatically increases as needed during execution, up to the reserved heap size. The default is 4 K.


Generate Import Library

This option determines whether an import library is generated. The field associated with the option allows the output name for the import library to be set. The File Name field triggers simultaneous changes in the import library field while being edited.


x86 Processor

The x86 Processor panel, shown in Figure 8.4, is where settings related to code generation for the Win32/x86 platform are controlled.

The items in this panel are:

 

Target Processor  
Debug Information  
Byte Alignment  
Use MMX/3DNow! Calling Conventions  
Exception Handling  
Inline Intrinsic Functions  
Extended Instructions  
Machine Code Listing  

The x86 Processor panel.:

Target Processor

This list-box specifies the processor for which to generate object code. The available are:


Byte Alignment

Specifies the alignment boundary for structure and class members. Each member is aligned on a multiple of either the specified alignment or the size of the member, whichever is bigger.

For example, if you set the byte alignment to 16 bytes and the member size to 2 bytes, it will be aligned on a 16-byte boundary; if the byte alignment is 4 bytes and the member size is 8 bytes, it will be aligned on a 8-byte boundary. If the byte alignment is set to 1, all members will start on the next available byte, with no padding between members. Setting Byte Alignment to 4 or 8 can improve execution speed, but with a penalty in memory usage if structures have wasted space.


Exception Handling

The Exception Handling list-box allows switching between handling schemes.

The possible settings are:


Extended Instructions

The Extended Instructions area contains options controlling the generation of instructions for specific processors. Which, if any, options are available depends on the processor selected in the Target Processor list-box.

or on the Intel Developer web site at:


http://developer.intel.com

SSE-enables the generation of SSE instructions when developing for Pentium III. To learn more about this Pentium III feature, look on the World Wide Web at:
http://developer.intel.com/technology/itj/Q21999/ARTICLES/art_2.htm

or on the Intel Developer web site at:


http://developer.intel.com


Debug Information

The Debug Information area contains options controlling the generation of symbolic debugging information.


NOTE

To generate CodeView symbolics for debugging, you must enable the CodeView Format option in the x86 Processor panel and the Generate CV Info option in the x86 Linker panel.



Use MMX/3DNow! Calling Conventions

Enabling the Use MMX/3DNow! Calling Conventions option enables the generation of 3DNow! extensions with further optimization for speed.

To learn more about optimizing for AMD K6 or AMD Athlon processors, see "Targeting AMD Processors."


Inline Intrinsic Functions

The CodeWarrior x86 C/C++ compiler provides intrinsic functions to generate inline x86 instructions. These intrinsic functions execute faster than other functions because the compiler translates them into inline assembly instructions instead of function calls. A list of the function calls available for inlining is listed in Figure 8.5.

Enable this option to tell the compiler to inline these functions.

Functions available for inlining under the x86 C/C++ compiler:// memory allocation
void * _alloca (size_t n)

// block memory operations
void * memmove (void *dest, const void *source, size_t n)
void * memcpy (const void *dest, const void *source, size_t n)
char * strcpy (char *dest, const char *src)
size_t strlen (const char *s)

// floating point math
double sin (double x)
double cos (double x)
double tan (double x)
double atan (double x)
double atan2 (double x)
double acos (double x)
double asin (double x)
double log10 (double x)
double log (double x)
double exp (double x)
double pow (double x)
double sqrt (double x)
double fabs (double x)

// x86 hardware operations
void _outp (unsigned short port, unsigned char val)
void _outpw (unsigned short port, unsigned short val)
void _outpd (unsigned short port, unsigned long val)
unsigned char _inp (unsigned short port)
unsigned short _inpw (unsigned short port)
unsigned long _inpd (unsigned short port)
// memory allocation
void * _alloca (size_t n)

// block memory operations
void * memmove (void *dest, const void *source, size_t n)
void * memcpy (const void *dest, const void *source, size_t n)
char * strcpy (char *dest, const char *src)
size_t strlen (const char *s)

// floating point math
double sin (double x)
double cos (double x)
double tan (double x)
double atan (double x)
double atan2 (double x)
double acos (double x)
double asin (double x)
double log10 (double x)
double log (double x)
double exp (double x)
double pow (double x)
double sqrt (double x)
double fabs (double x)

// x86 hardware operations
void _outp (unsigned short port, unsigned char val)
void _outpw (unsigned short port, unsigned short val)
void _outpd (unsigned short port, unsigned long val)
unsigned char _inp (unsigned short port)
unsigned short _inpw (unsigned short port)
unsigned long _inpd (unsigned short port)


// memory allocation
void * _alloca (size_t n)

// block memory operations void * memmove (void *dest, const void *source, size_t n) void * memcpy (const void *dest, const void *source, size_t n) char * strcpy (char *dest, const char *src) size_t strlen (const char *s) // floating point math double sin (double x) double cos (double x) double tan (double x) double atan (double x) double atan2 (double x) double acos (double x) double asin (double x) double log10 (double x) double log (double x) double exp (double x) double pow (double x) double sqrt (double x) double fabs (double x) // x86 hardware operations void _outp (unsigned short port, unsigned char val) void _outpw (unsigned short port, unsigned short val) void _outpd (unsigned short port, unsigned long val) unsigned char _inp (unsigned short port) unsigned short _inpw (unsigned short port) unsigned long _inpd (unsigned short port)


NOTE

Support for intrinsic functions is not part of the ANSI C or C++ standards. They are an extension provided by the CodeWarrior compilers.



WARNING!

Type case is important for intrinsic functions, as is getting the function prototype correct. In the absence of prototypes, the compiler may generate incorrect code for these functions.



Machine Code Listing

This option generates a mixed listing of your source files that includes both the original source code and the machine code generated by the CodeWarrior IDE. You can use the disassembler to obtain a listing of machine code, but without the accompanying source code. For more information on the disassembler, refer to the IDE User Guide.


Windows RC

The Windows RC panel, shown in Figure 8.6, allows you to specify a file that is scanned for resource information during the compilation of your code. See "Creating Win32 Resources" for more information about working with resources.

Windows RC panel:

x86 Linker

The x86 Linker panel, shown in Figure 8.7, is where you control settings related to linking your object code into final form, be it executable, library, or other type of code.

These items in this panel are:

 

Entry Point Usage  
Generate Link Map  
Name  
Generate SYM File  
SubSystem  
Generate CV Info  
SubSystem ID  
Generate CV Info  
UserID  
 

The x86 Linker panel.:

Entry Point Usage

This list-box specifies the name of the project's main entry point:


WARNING!

Use this setting only in projects that do not use C or C++ run-time library functions; otherwise, the run-time library will not be initialized and library functions may fail.


For an example of when this setting is useful, see "DLL Initialization."

Default entry points:

 

For this project type
The linker sets the entry point to this symbol
Windows GUI  
_WinMainCRTStartup  
Console  
_mainCRTStartup  
DLL  
_DllMainCRTStartup@12  


Name

This field specifies the name of the symbol that provides the entry point for the module. This field is only available if the User Specified setting is selected in the Entry Point Usage list-box.


SubSystem

Select a setting from the SubSystem list-box as follows:

¯ If _main is defined, the subsystem is Windows CUI.

¯ If _WinMain@16 or _wWinMain@16 is defined, the subsystem is Windows GUI.

Native-use this setting for drivers and system executables Windows GUI-use this setting for applications using the Win32 graphical user interface Windows CUI-use this setting for Win32 console applications

SubSystem ID

This field identifies a specific version of the selected subsystem. The value of this setting is a floating-point number, with the integer part giving the major ID and the fractional part the minor ID:

For other subsystems, the subsystem ID is undefined.


UserID

This field specifies a version number for your application or library, which will appear in the header of the output file. You can set it to any floating-point value you wish.


Generate Link Map

When enabled, this option generates a link map listing the items the linker processed.


Generate SYM File

When enabled, this option generates a SYM file containing symbolic debugging information in SYM format.


Generate CV Info

When enabled, this option stores symbolic debugging information in the object file (whether an executable application or a DLL) in CodeView format.


Command File

This field specifies the name of the linker command file, an optional text file containing additional commands for controlling the operation of the linker.


NOTE

To generate symbolic debugging information in either SYM or CodeView format, you must turn on the corresponding settings in both the x86 Processor and x86 Linker project settings panels.



x86 Disassembler

The x86 Disassembler panel, as shown in Figure 8.8, controls the information displayed during disassembly.

x86 Disassembler panel:

The items in this panel are:

 

Decode Object Headers  
Show Symbols and Strings  
Decode Text Sections  
Decode Debug Sections  
Show Exception Tables  
Show Data Sections  
Display Hex Dumps  
Verbose Information  


Decode Object Headers

The Decode Object Headers option determines whether the assembled file lists any header information in the disassembled output.


Show Symbols and Strings

The Show Symbols and Strings option determines whether the disassembler lists the symbol table for the disassembled module.


Decode Text Sections

The Decode Text Sections option determines whether text sections appear in the disassembled output.

When this option is enabled, the following additional options become available:


Decode Debug Sections

The Decode Debug Sections option determines whether to include debug symbol information in the disassembled output.


Show Exception Tables

The Show Exception Tables option determines whether the disassembler outputs exception tables for the disassembled module.


Show Data Sections

The Show Data Sections option determines whether the disassembler shows data sections in the disassembled output.


Display Hex Dumps

The Display Hex Dumps option determines whether unstructured hex dumps appear in the disassembled output.


Verbose Information

The Verbose Information option determines whether the disassembler shows additional information about certain types of information in the linker file.


Runtime Settings

The Runtime Settings panel presents settings for configuring the runtime environment that your project will run in while it is under the debugger's control.

Environment variables listed in this panel are created when the project is launched and removed when the project finishes executing. The IDE ensures that these environment variables have no effect on previously defined or global environment variables.

Runtime Settings panel:

The items in this panel are:

 

Host Application for Libraries & Code Resources  
Program Arguments  
Working Directory  
Environment Settings  


Host Application for Libraries & Code Resources

This field allows you to specify the application used to drive the libraries for debugging purposes. When the library is debugged, the program specified in this field will be launched to provide the host environment for your library code. Click the Choose button to navigate to the program file, or click Clear to remove any settings in this field.


Working Directory

This field specifies the default directory to which the project will have access.


Program Arguments

Specifies command-line text to pass to the project when it is launched by the IDE debugger.


Environment Settings

This area contains items that control the IDE environment.


Debugger Settings

The Debugger Settings panel is used to select the tools to use for debugging your project. Additionally, you can import pre-defined debugger settings from an XML file by clicking Import, or export the settings in this panel by clicking Export.

Debugger Settings panel:

The items in this panel are:

 

Location of Relocated Libraries, etc.  
Stop at temp breakpoint on application launch  
Auto-target Libraries  
Log System Messages  
Update data every [value] seconds  
Cache symbolics between runs  
Stop at Watchpoints  
 


Location of Relocated Libraries, etc.

Launches a program before running the project under the debugger's control. Click Choose to navigate to the folder in which the program is stored. This option is most useful when debugging a piece of software that acts as a plug-in or extension to another program.


Stop at temp breakpoint on application launch

This option controls whether or not the debugger stops when a temporary breakpoint is reached. When enabled, the following two radio buttons become available:


Log System Messages

Controls the display of messages in the debugger's log window. If selected, messages about the actions the debugger takes while controlling your application appear in the log window.


NOTE

This feature is only available when debugging on Windows.



Auto-target Libraries

This option allows you to decide whether libraries will be automatically targeted for debugging.


Update data every [value] seconds

This option allows you to choose the rate at which data updates occur.


Cache symbolics between runs

When enabled, this option caches symbolic debugger information.


Stop at Watchpoints

This option allows you to decide whether or not the debugger will stop at watchpoints.


x86 Exceptions

The x86 Exceptions panel, shown in Figure 8.11, lists all the exceptions that the debugger is able to catch. If you want the debugger to catch all the exceptions, enable all of the options in this panel. However, if you prefer to handle only certain exceptions, enable only those options that reflect the exceptions you prefer to handle.

Additionally, you can import pre-defined exceptions settings from an XML file by clicking Import, or export the settings in this panel by clicking Export.

x86 Exceptions panel:


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000