NLM Development Concepts, Tools, and Functions Novdocx (En) 11 December 2007
Total Page:16
File Type:pdf, Size:1020Kb
NDK: NLM Development Concepts, Tools, and Functions novdocx (en) 11 December 2007 December 11 (en) novdocx Novell Developer Kit www.novell.com NLM™ DEVELOPMENT CONCEPTS, February 2008 TOOLS, AND FUNCTIONS novdocx (en) 11 December 2007 December 11 (en) novdocx Legal Notices Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. Further, Novell, Inc. makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to make changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes. Any products or technical information provided under this Agreement may be subject to U.S. export controls and the trade laws of other countries. You agree to comply with all export control regulations and to obtain any required licenses or classification to export, re-export, or import deliverables. You agree not to export or re-export to entities on the current U.S. export exclusion lists or to any embargoed or terrorist countries as specified in the U.S. export laws. You agree to not use deliverables for prohibited nuclear, missile, or chemical biological weaponry end uses. Please refer to www.novell.com/info/exports/ for more information on exporting Novell software. Novell assumes no responsibility for your failure to obtain any necessary export approvals. Copyright © 1993-2008 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher. Novell, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.novell.com/company/legal/patents/ and one or more additional patents or pending patent applications in the U.S. and in other countries. Novell, Inc. 404 Wyman Street, Suite 500 Waltham, MA 02451 U.S.A. www.novell.com Online Documentation: To access the online documentation for this and other Novell developer products, and to get updates, see developer.novell.com/ndk. To access online documentation for Novell products, see www.novell.com/documentation. novdocx (en) 11 December 2007 December 11 (en) novdocx Novell Trademarks For a list of Novell trademarks, see Trademarks (http://www.novell.com/company/legal/trademarks/tmlist.html). Third-Party Materials All third-party trademarks are the property of their respective owners. novdocx (en) 11 December 2007 novdocx (en) 11 December 2007 December 11 (en) novdocx Contents About This Guide 11 1 Getting Started 13 1.1 Requirements . 13 1.2 Installing the CLib SDK . 13 1.3 Selecting a Compiler . 14 1.3.1 Metrowerks CodeWarrior for NetWare . 14 1.3.2 Open Watcom Compiler . 14 1.3.3 GNU and Other Compilers . 15 1.4 Setting Up a Compiler . 15 1.4.1 Setting Up CodeWarrior for NLM Development . 15 1.4.2 Setting Up Open Watcom with Borland C++ Builder. 17 1.4.3 Using the WATCOM IDE. 18 1.5 Using a Linker . 21 1.5.1 Specifying a Linker Definition File . 22 1.5.2 Linker Commands . 23 1.6 Writing a Basic NLM . 32 1.7 Installing the CLib Files on a NetWare Server. 32 2 Basic NLM Concepts 35 2.1 What NLMs Are . 35 2.2 What NLMs Do . 35 2.3 Misconceptions About NLMs . 35 2.3.1 NLMs Are Not Hard to Develop. 35 2.3.2 NLMs Are Not Dead . 36 2.4 Developing NLMs . 36 2.5 Loading and Unloading NLMs . 36 2.5.1 Using Search Paths. 37 2.5.2 How NLMs Are Loaded . 37 2.5.3 Using the LOAD Command. 38 2.5.4 Setting Environment Variables . 41 2.5.5 Autoloading Prerequisite NLMs. 41 2.5.6 Loading Multiple NLMs . 41 2.5.7 Importing and Exporting NLMs . 41 2.5.8 Unloading NLMs . 42 2.6 Introduction to CLIB . 42 2.6.1 Cross Platform NLM Libraries . 43 2.6.2 Prelude Object Files . 43 2.6.3 CLIB Manuals . 44 2.7 OS-Related Issues. 45 2.7.1 Preemptive and Nonpreemptive Environment. 45 2.7.2 Current Working Directory. 46 2.7.3 Connection Numbers and Task Numbers . 46 2.7.4 Screens and the NetWare OS. 46 2.7.5 Screen Types . 47 2.8 Structure of an NLM. 47 2.9 NLM Startup. 48 2.9.1 Reentrant NLMs . 48 Contents 5 novdocx (en) 11 December 2007 December 11 (en) novdocx 2.10 NLM Termination . 51 2.10.1 NLM Unload Process . 51 2.10.2 NLM Self-Termination Process . 52 2.10.3 NLM Abnormal Exit Process . 53 2.10.4 Following Exit Steps. 54 2.10.5 CHECK Function . 54 2.10.6 Signal Handling . 56 2.10.7 AtUnload and atexit Functions . 57 2.10.8 Freeing Resources upon Exit. 59 3 More Advanced NLM Concepts 61 3.1 Data and Parameters in NLMs . 61 3.1.1 Data Alignment. 61 3.1.2 C Parameter Ordering . 64 3.2 Threads, Multithreaded Programming, and Context. 65 3.3 Screen Handling . 65 3.3.1 Screen Creation . 65 3.3.2 Screen Deletion . ..