ILE C/C++ Programmer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
IBM i 7.2 Programming IBM Rational Development Studio for i ILE C/C++ Programmer's Guide IBM SC09-2712-07 Note Before using this information and the product it supports, read the information in “Notices” on page 441. This edition applies to version 7, release 2, modification 0 of IBM Rational Development Studio for i (product number 5770-WDS) and to all subsequent releases and modifications until otherwise indicated in new editions. This version does not run on all reduced instruction set computer (RISC) models nor does it run on CISC models. This document may contain references to Licensed Internal Code. Licensed Internal Code is Machine Code and is licensed to you under the terms of the IBM License Agreement for Machine Code. © Copyright International Business Machines Corporation 1993, 2013. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents ILE C/C++ Programmer’s Guide..............................................................................1 PDF file for ILE C/C++ Programmer’s Guide............................................................................................... 3 About ILE C/C++ Programmer's Guide........................................................................................................5 Install Licensed Program Information................................................................................................... 5 Notes About Examples........................................................................................................................... 5 Control Language Commands and the Procedures in This Guide.........................................................5 Introduction................................................................................................................................................. 7 Introduction to the ILE C/C++ Compiler................................................................................................ 7 Multi-Language Program Creation....................................................................................................7 Programming Languages Supported by the IBM i Operating System........................................7 ILE Program Creation.................................................................................................................. 7 Binding Directories...................................................................................................................... 8 Service Programs.........................................................................................................................8 Program and Resource Management............................................................................................... 8 Program Flow...............................................................................................................................8 Program and Procedure Calls................................................................................................ 9 Resource Allocation.....................................................................................................................9 Bindable APIs.............................................................................................................................. 9 Runtime Exceptions.....................................................................................................................9 Program Debugging...........................................................................................................................9 Creating and Compiling Programs.............................................................................................................11 Creating a Program...............................................................................................................................11 The Program Development Process...............................................................................................11 Preparing a Program..................................................................................................................11 Compiling a Program................................................................................................................. 11 Binding Modules........................................................................................................................12 Running or Calling Objects........................................................................................................12 Debugging a Program................................................................................................................ 12 Entering Source Statements...........................................................................................................13 Example Of Creating a Source File............................................................................................13 Instructions............................................................................................................................... 13 Source Code Sample................................................................................................................. 13 Creating a Program in One Step..................................................................................................... 14 Creating a Program in Two Steps................................................................................................... 15 Identifying Program and User Entry Procedures......................................................................16 Understanding the Internal Structure of a Program Object.....................................................16 Using Static Procedure Calls..................................................................................................... 16 Working with Binding Directories..............................................................................................17 Creating a Binding Directory..................................................................................................... 17 Using the Binder to Create a Program ..................................................................................... 17 Preparing to Create a Program..................................................................................................17 Specifying Parameters for the CRTPGM Command................................................................. 18 How Import Requests Are Resolved.........................................................................................19 Using a Binder Listing................................................................................................................19 Updating a Module or a Program Object ..................................................................................20 Updating a Program...................................................................................................................21 Activating Groups...................................................................................................................... 21 iii Messaging Support......................................................................................................................... 21 Service Programs..................................................................................................................................22 Differences Between Programs and Service Programs................................................................. 22 Public Interface...............................................................................................................................22 Considerations When Creating a Service Program........................................................................ 23 Using the Binder to Create a Service Program...............................................................................23 Specifying Parameters for the CRTSRVPGM Command...........................................................23 Updating or Changing a Service Program................................................................................. 24 Using Control Language (CL) Commands with Service Programs............................................24 Creating, Compiling, and Binding a Service Program.................................................................... 24 Creating the Source Files.......................................................................................................... 24 User Header File.................................................................................................................. 25 Source Code Files................................................................................................................ 25 Compiling and Binding the Service Program............................................................................ 26 Binding the Service Program to a Program...............................................................................27 Working with Exports from Service Programs..................................................................................... 28 Determining Exports from Service Programs.................................................................................28 Displaying Exported Defined Symbols with the Display Module Command........................... 28 Creating a Binder Language Source File.........................................................................................29 Creating Binder