Watcom Linker
Total Page:16
File Type:pdf, Size:1020Kb
Open Watcom Linker 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 Linker User's Guide describes how to use the Open Watcom Linker under DOS, OS/2, Windows 9x, Windows NT and QNX. The Open Watcom Linker can generate executable files that run under DOS, CauseWay DOS extender, FlashTek's DOS extender, Phar Lap's 386|DOS-Extender and TNT DOS extender, Tenberry Software's DOS/4G, Microsoft Windows 3.x, Microsoft Windows NT/2000/XP, Microsoft Windows 95/98/Me, IBM OS/2, QNX, and Novell's NetWare operating system. The Open Watcom Linker can also generate ELF format executable files for those systems that will support ELF. The Microsoft Response File conversion utility, MS2WLINK, is also described in this book. 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. July, 1997. Trademarks Used in this Manual DOS/4G is a trademark of Tenberry Software, Inc. OS/2 and Presentation Manager are trademarks of International Business Machines Corp. IBM, IBM PC and IBM PS/2 are registered trademarks of International Business Machines Corp. Intel is a registered trademark of Intel Corp. Microsoft, Windows and Windows 95 are registered trademarks of Microsoft Corp. Windows NT is a trademark of Microsoft Corp. iii NetWare, NetWare 386, and Novell are registered trademarks of Novell, Inc. Phar Lap, 386|DOS-Extender and TNT are trademarks of Phar Lap Software, Inc. QNX is a registered trademark of QNX Software Systems Ltd. WATCOM is a trademark of Sybase, Inc. and its subsidiaries. iv Table of Contents The Open Watcom Linker ......................................................................................................... 1 1 The Open Watcom Linker ........................................................................................... 3 2 Linking Executable Files for Various Systems ........................................................... 5 2.1 Using the SYSTEM Directive ...................................................................... 5 2.2 Linking 16-bit x86 Executable Files ............................................................ 9 2.2.1 Linking 16-bit x86 DOS Executable Files ..................................... 9 2.2.2 Linking 16-bit x86 DOS .COM Executable Files .......................... 9 2.2.3 Linking 16-bit x86 OS/2 Executable Files ..................................... 9 2.2.4 Linking 16-bit x86 OS/2 Dynamic Link Libraries ......................... 10 2.2.5 Linking 16-bit x86 QNX Executable Files .................................... 10 2.2.6 Linking 16-bit x86 Windows 3.x Executable Files ........................ 10 2.2.7 Linking 16-bit x86 Windows 3.x Dynamic Link Libraries ............ 11 2.3 Linking 32-bit x86 Executable Files ............................................................ 11 2.3.1 Linking 32-bit x86 DOS/4GW Executable Files ........................... 11 2.3.2 Linking 32-bit x86 FlashTek Executable Files .............................. 11 2.3.3 Linking 32-bit x86 Novell NetWare Loadable Modules ............... 12 2.3.4 Linking 32-bit x86 OS/2 Executable Files ..................................... 13 2.3.5 Linking 32-bit x86 OS/2 Dynamic Link Libraries ......................... 13 2.3.6 Linking 32-bit x86 OS/2 Presentation Manager Executable Files ................................................................................................ 13 2.3.7 Linking 32-bit x86 Phar Lap Executable Files ............................... 14 2.3.8 Linking 32-bit x86 Phar Lap TNT Executable Files ...................... 14 2.3.9 Linking 32-bit x86 QNX Executable Files .................................... 14 2.3.10 Linking 32-bit x86 Extended Windows 3.x Executable .............. 15 2.3.11 Linking 32-bit x86 Extended Windows 3.x Dynamic Link Libraries ....................................................................................... 15 2.3.12 Linking 32-bit x86 Windows 3.x or 9x Virtual Device Driver .... 16 2.3.13 Linking 32-bit x86 Windows 95 Executable Files ....................... 16 2.3.14 Linking 32-bit x86 Windows 95 Dynamic Link Libraries ........... 17 2.3.15 Linking 32-bit x86 Windows NT Character-Mode Executable Files .............................................................................................. 17 2.3.16 Linking 32-bit x86 Windows NT Windowed Executable Files ... 17 2.3.17 Linking 32-bit x86 Windows NT Dynamic Link Libraries ......... 18 3 Linker Directives and Options .................................................................................... 19 3.1 The ALIAS Directive ................................................................................... 22 3.2 The ALIGNMENT Option ........................................................................... 23 3.3 The ANONYMOUSEXPORT Directive ...................................................... 24 3.4 The AREA Option ........................................................................................ 26 3.5 The ARTIFICIAL Option ............................................................................. 27 v Table of Contents 3.6 The AUTOSECTION Directive ................................................................... 28 3.7 The AUTOUNLOAD Option ....................................................................... 29 3.8 The BEGIN Directive ................................................................................... 30 3.9 The CACHE Option ..................................................................................... 31 3.10 The CASEEXACT Option ......................................................................... 32 3.11 The CHECK Option ................................................................................... 33 3.12 The CHECKSUM Option ........................................................................... 34 3.13 The # Directive ........................................................................................... 35 3.14 The COMMIT Directive ............................................................................. 36 3.15 The COPYRIGHT Option .......................................................................... 37 3.16 The CUSTOM Option ................................................................................ 38 3.17 The CVPACK Option ................................................................................. 39 3.18 The DEBUG Directive ............................................................................... 40 3.18.1 Line Numbering Information - DEBUG WATCOM LINES ....... 42 3.18.2 Local Symbol Information - DEBUG WATCOM LOCALS ...... 43 3.18.3 Typing Information - DEBUG WATCOM TYPES ..................... 43 3.18.4 All Debugging Information - DEBUG WATCOM ALL ............. 44 3.18.5 Global Symbol Information ......................................................... 44 3.18.6 Global Symbols for the NetWare Debugger - DEBUG NOVELL ...................................................................................... 44 3.18.7 The ONLYEXPORTS Debugging Option ................................... 44 3.18.8 Using DEBUG Directives ............................................................ 45 3.18.9 Removing Debugging Information from an Executable File ....... 46 3.19 The DESCRIPTION Option ....................................................................... 47 3.20 The DISABLE Directive ............................................................................ 48 3.21 The DISTRIBUTE Option .......................................................................... 50 3.22 The DOSSEG Option ................................................................................. 51 3.23 The DYNAMIC Option .............................................................................. 53 3.24 The ELIMINATE Option ........................................................................... 54 3.25 The END Directive ..................................................................................... 55 3.26 The ENDLINK Directive ........................................................................... 56 3.27 The EXIT Option ........................................................................................ 57 3.28 The EXPORT Directive .............................................................................. 58 3.28.1 EXPORT - OS/2, Win16, Win32 only ......................................... 58 3.28.2 EXPORT - ELF only .................................................................... 60 3.28.3 EXPORT - Netware only ............................................................