Watcom C/C++ Tools
Total Page:16
File Type:pdf, Size:1020Kb
Open Watcom C/C++ Tools User’s Guide First Edition Notice of Copyright 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/ Printed in U.S.A. ii Preface The Open Watcom C/C++ Tools User's Guide describes how to use Open Watcom's software development tools on Intel 80x86-based personal computers with DOS, Windows, or OS/2. The Open Watcom C/C++ Tools User's Guide describes the following tools: · compile and link utility · assembler · object file library manager · object file disassembler · exe2bin utility · far call optimization utility · patch utility · executable file strip utility · make utility · touch utility Acknowledgements This book was produced with the Open Watcom GML electronic publishing system, a software tool developed by WATCOM. In this system, writers use an ASCII text editor to create source files containing text annotated with tags. These tags label the structural elements of the document, such as chapters, sections, paragraphs, and lists. The Open Watcom GML software, which runs on a variety of operating systems, interprets the tags to format the text into a form such as you see here. Writers can produce output for a variety of printers, including laser printers, using separately specified layout directives for such things as font selection, column width and height, number of columns, etc. The result is type-set quality copy containing integrated text and graphics. iii July, 1997. Trademarks Used in this Manual OS/2 is a trademark of International Business Machines Corp. IBM is a registered trademark of International Business Machines Corp. Intel are registered trademarks of Intel Corp. Microsoft, Windows and Windows 95 are registered trademarks of Microsoft Corp. Windows NT is a trademark of Microsoft Corp. NetWare, NetWare 386, and Novell are registered trademarks of Novell, Inc. Phar Lap, 286|DOS-Extender, and 386|DOS-Extender are trademarks of Phar Lap Software, Inc. QNX is a registered trademark of QNX Software Systems Ltd. UNIX is a registered trademark of UNIX System Laboratories, Inc. WATCOM is a trademark of Sybase, Inc. and its subsidiaries. iv Table of Contents The Open Watcom Compile and Link Utility ........................................................................... 1 1 The Open Watcom C/C++ Compile and Link Utility ................................................. 3 1.1 WCL/WCL386 Command Line Format ....................................................... 3 1.2 Open Watcom Compile and Link Options Summary ................................... 4 1.3 WCL/WCL386 Environment Variables ....................................................... 10 1.4 WCL/WCL386 Command Line Examples ................................................... 11 The Open Watcom Assembler ................................................................................................... 15 2 The Open Watcom Assembler .................................................................................... 17 2.1 Introduction .................................................................................................. 17 2.2 Assembly Directives and Opcodes ............................................................... 19 2.3 Unsupported Directives ................................................................................ 28 2.4 Open Watcom Assembler Specific ............................................................... 28 2.4.1 Naming convention ........................................................................ 29 2.4.2 Open Watcom "C" name mangler .................................................. 29 2.4.3 Calling convention ......................................................................... 30 2.5 Open Watcom Assembler Diagnostic Messages .......................................... 30 Object File Utilities ................................................................................................................... 41 3 The Open Watcom Library Manager .......................................................................... 43 3.1 Introduction .................................................................................................. 43 3.2 The Open Watcom Library Manager Command Line .................................. 44 3.3 Open Watcom Library Manager Module Commands .................................. 46 3.4 Adding Modules to a Library File ................................................................ 46 3.5 Deleting Modules from a Library File .......................................................... 47 3.6 Replacing Modules in a Library File ............................................................ 47 3.7 Extracting a Module from a Library File ...................................................... 48 3.8 Creating Import Libraries ............................................................................. 49 3.9 Creating Import Library Entries ................................................................... 50 3.10 Commands from a File or Environment Variable ...................................... 51 3.11 Open Watcom Library Manager Options ................................................... 51 3.11.1 Suppress Creation of Backup File - "b" Option ........................... 51 3.11.2 Case Sensitive Symbol Names - "c" Option ................................ 51 3.11.3 Specify Output Directory - "d" Option ........................................ 52 3.11.4 Specify Output Format - "f" Option ............................................. 52 3.11.5 Generating Imports - "i" Option ................................................... 52 3.11.6 Creating a Listing File - "l" Option .............................................. 53 v Table of Contents 3.11.7 Display C++ Mangled Names - "m" Option ................................ 54 3.11.8 Always Create a New Library - "n" Option ................................. 54 3.11.9 Specifying an Output File Name - "o" Option ............................. 54 3.11.10 Specifying a Library Record Size - "p" Option .......................... 55 3.11.11 Operate Quietly - "q" Option ..................................................... 55 3.11.12 Strip Line Number Records - "s" Option ................................... 55 3.11.13 Trim Module Name - "t" Option ................................................ 56 3.11.14 Operate Verbosely - "v" Option ................................................. 56 3.11.15 Explode Library File - "x" Option .............................................. 56 3.12 Librarian Error Messages ........................................................................... 57 4 The Object File Disassembler ..................................................................................... 61 4.1 Introduction .................................................................................................. 61 4.2 Changing the Internal Label Character - "i=<char>" ................................... 62 4.3 The Assembly Format Option - "a" .............................................................. 62 4.4 The External Symbols Option - "e" .............................................................. 63 4.5 The No Instruction Name Pseudonyms Option - "fp" .................................. 64 4.6 The No Register Name Pseudonyms Option - "fr" ....................................... 64 4.7 The Alternate Addressing Form Option - "fi" .............................................. 64 4.8 The Uppercase Instructions/Registers Option - "fu" .................................... 64 4.9 The Listing Option - "l[=<list_file>]" .......................................................... 65 4.10 The Public Symbols Option - "p" ............................................................... 65 4.11 Retain C++ Mangled Names - "m" ............................................................ 66 4.12 The Source Option - "s[=<source_file>]" .................................................. 66 4.13 An Example ................................................................................................ 67 5 Optimization of Far Calls ............................................................................................ 73 5.1 Far Call Optimizations for Non-Open Watcom Object Modules ................. 74 5.1.1 The Open Watcom Far Call Optimization Enabling Utility .......... 74 6 The Open Watcom Exe2bin Utility ............................................................................. 77 6.1 The Open Watcom Exe2bin Utility Command Line .................................... 78 6.2 Exe2bin Messages ........................................................................................ 80 Executable Image Utilities ........................................................................................................ 83 7 The Open Watcom Patch Utility ................................................................................. 85 7.1 Introduction .................................................................................................. 85 7.2 Applying a Patch .......................................................................................... 85 7.3 Diagnostic Messages .................................................................................... 86 vi Table of Contents 8 The Open Watcom Strip Utility .................................................................................