xl c/c++: getting started · names, compiler options, and dir ectives. the compiler pr ovides basic...

48
IBM XL C/C++ for AIX, V16.1 Getting Started with XL C/C++ Version 16.1 SC27-8055-00 IBM

Upload: others

Post on 11-Feb-2020

33 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

IBM XL C/C++ for AIX, V16.1

Getting Started with XL C/C++Version 16.1

SC27-8055-00

IBM

Page 2: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation
Page 3: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

IBM XL C/C++ for AIX, V16.1

Getting Started with XL C/C++Version 16.1

SC27-8055-00

IBM

Page 4: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

NoteBefore using this information and the product it supports, read the information in “Notices” on page 25.

First edition

This edition applies to IBM XL C/C++ for AIX, V16.1 (Program 5765-J12; 5725-C72) and to all subsequent releasesand modifications until otherwise indicated in new editions. Make sure you are using the correct edition for thelevel of the product.

© Copyright IBM Corporation 1996, 2018.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

Page 5: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Contents

About this document . . . . . . . . . vWho should read this document . . . . . . . . vHow to use this document. . . . . . . . . . vHow this document is organized . . . . . . . vConventions . . . . . . . . . . . . . . viRelated information . . . . . . . . . . . . x

Available help information. . . . . . . . . xStandards and specifications. . . . . . . . xii

Technical support . . . . . . . . . . . . xiiiHow to send your comments . . . . . . . . xiii

Chapter 1. Introducing XL C/C++ . . . . 1A two-in-one compiler: Clang-based front end andXL-based front end . . . . . . . . . . . . 1Commonality with other IBM compilers . . . . . 1Operating system and hardware support . . . . . 2A highly configurable compiler . . . . . . . . 2Language standard compliance . . . . . . . . 3

Compatibility with GNU . . . . . . . . . 4Source-code migration and conformance checking 4

Libraries . . . . . . . . . . . . . . . . 4Tools, utilities, and commands . . . . . . . . 6Program optimization . . . . . . . . . . . 864-bit object capability . . . . . . . . . . . 8Shared memory parallelization . . . . . . . . 9Diagnostic reports . . . . . . . . . . . . 10Symbolic debugger support . . . . . . . . . 10

Chapter 2. Setting up and customizingXL C/C++ . . . . . . . . . . . . . . 11Using custom compiler configuration files . . . . 11

Configuring compiler utilization tracking andreporting . . . . . . . . . . . . . . . 11

Chapter 3. Developing applicationswith XL C/C++ . . . . . . . . . . . 13Compiler phases. . . . . . . . . . . . . 13Editing C/C++ source files . . . . . . . . . 13Compiling with XL C/C++ . . . . . . . . . 14

Invoking the compiler . . . . . . . . . . 14Compiling parallelized XL C/C++ applications 14Specifying compiler options . . . . . . . . 15XL C/C++ input and output files . . . . . . 16

Linking your compiled applications with XL C/C++ 17Relinking an existing executable file . . . . . 17Dynamic and static linking . . . . . . . . 17Diagnosing link-time problems . . . . . . . 18

Running your compiled application . . . . . . 19XL C/C++ compiler diagnostic aids . . . . . . 20

Debugging compiled applications . . . . . . 20Determining which level of XL C/C++ is beingused . . . . . . . . . . . . . . . . 21

Appendix. Accessibility features forIBM XL C/C++ for AIX . . . . . . . . 23

Notices . . . . . . . . . . . . . . 25Trademarks . . . . . . . . . . . . . . 27

Index . . . . . . . . . . . . . . . 29

© Copyright IBM Corp. 1996, 2018 iii

Page 6: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

iv XL C/C++: Getting Started

Page 7: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

About this document

This document contains overview and basic usage information for the IBM® XLC/C++ for AIX®, V16.1 compiler.

Who should read this documentThis document is intended for C and C++ developers who are looking forintroductory overview and usage information for XL C/C++. It assumes that youhave some familiarity with command-line compilers, basic knowledge of the C andC++ programming languages, and basic knowledge of operating systemcommands. Programmers new to XL C/C++ can use this document to findinformation about the capabilities and features unique to XL C/C++.

How to use this document

Unless indicated otherwise, all of the text in this reference pertains to both C andC++ languages. Where there are differences between languages, these are indicatedthrough qualifying text and icons, as described in “Conventions” on page vi.

Throughout this document, the xlc, xlc++, xlC, xlclang, and xlclang++ invocationcommands are used to describe the behavior of the compiler. You can, however,substitute other forms of the compiler invocation command if your particularenvironment requires it, and compiler option usage might differ.

While this document covers general information such as configuring the compilerenvironment, and compiling and linking C or C++ applications using the XLC/C++ compiler, it does not include the following topics:v An executive overview of new functions: see the What's New for XL C/C++.v Compiler installation: see the XL C/C++ Installation Guide.v Migration considerations and guide: see the XL C/C++ Migration Guide.v Compiler options: see the XL C/C++ Compiler Reference for detailed information

about the syntax and usage of compiler options.v The C or C++ programming language: see the XL C/C++ Language Reference for

information about the syntax, semantics, and IBM implementation of the C orC++ programming language.

v Programming topics: see the XL C/C++ Optimization and Programming Guide fordetailed information about developing applications with XL C/C++, with afocus on program portability and optimization.

How this document is organizedChapter 1, “Introducing XL C/C++,” on page 1 contains information about thefeatures of the XL C/C++ compiler at a high level.

Chapter 2, “Setting up and customizing XL C/C++,” on page 11 describes how toset up and customize the compiler according to your own requirements.

Chapter 3, “Developing applications with XL C/C++,” on page 13 consists ofrepeating cycles of editing, compiling, linking, and running.

© Copyright IBM Corp. 1996, 2018 v

Page 8: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

ConventionsTypographical conventions

The following table shows the typographical conventions used in the IBM XLC/C++ for AIX, V16.1 information.

Table 1. Typographical conventions

Typeface Indicates Example

bold Lowercase commands, executablenames, compiler options, anddirectives.

The compiler provides basicinvocation commands, xlcand xlC(xlc++), along with several othercompiler invocation commands tosupport various C/C++ languagelevels and compilation environments.

italics Parameters or variables whoseactual names or values are to besupplied by the user. Italics arealso used to introduce new terms.

Make sure that you update the sizeparameter if you return more thanthe size requested.

underlining The default setting of a parameterof a compiler option or directive.

nomaf | maf

monospace Programming keywords andlibrary functions, compiler builtins,examples of program code,command strings, or user-definednames.

To compile and optimizemyprogram.c, enter: xlc myprogram.c-O3.

Qualifying elements (icons)

Most features described in this information apply to both C and C++ languages. Indescriptions of language elements where a feature is exclusive to one language, orwhere functionality differs between languages, this information uses icons todelineate segments of text as follows:

Table 2. Qualifying elements

IconShortdescription Meaning

C

C

C only begins /

C only ends

The text describes a feature that is supported in the Clanguage only; or describes behavior that is specific tothe C language.

C++

C++

C++ only begins/

C++ only ends

The text describes a feature that is supported in theC++ language only; or describes behavior that isspecific to the C++ language.

C11

C11

C11 begins /

C11 ends

The text describes a feature that is introduced intostandard C as part of C11.

vi XL C/C++: Getting Started

Page 9: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Table 2. Qualifying elements (continued)

IconShortdescription Meaning

C++11

C++11

C++11 begins /

C++11 ends

The text describes a feature that is introduced intostandard C++ as part of C++11.

C++14

C++14

C++14 begins /

C++14 ends

The text describes a feature that is introduced intostandard C++ as part of C++14.

IBM

IBM

IBM extensionbegins /

IBM extensionends

The text describes a feature that is an IBM extension tothe standard language specifications.

xlc/xlC

xlc/xlC

IBM XL C/C++for AIX that isinvoked bylegacyinvocationsbegins/

IBM XL C/C++for AIX that isinvoked bylegacyinvocations ends

The text describes a feature that is specific to IBM XLC/C++ for AIX that is invoked by legacy invocations,such as xlc and xlC. For the full list of the legacyinvocations, see Legacy invocation commands in theXL C/C++ Compiler Reference.

xlclang/xlclang++

xlclang/xlclang++

IBM XL C/C++for AIX that isinvoked byxlclang/xlclang++invocationsbegins/

IBM XL C/C++for AIX that isinvoked byxlclang/xlclang++invocations ends

The text describes a feature that is specific to IBM XLC/C++ for AIX that is invoked by xlclang andxlclang++.

Syntax diagrams

Throughout this information, diagrams illustrate XL C/C++ syntax. This sectionhelps you to interpret and use those diagrams.v Read the syntax diagrams from left to right, from top to bottom, following the

path of the line.The ►►─── symbol indicates the beginning of a command, directive, or statement.The ───► symbol indicates that the command, directive, or statement syntax iscontinued on the next line.The ►─── symbol indicates that a command, directive, or statement is continuedfrom the previous line.

About this document vii

Page 10: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

The ───►◄ symbol indicates the end of a command, directive, or statement.Fragments, which are diagrams of syntactical units other than completecommands, directives, or statements, start with the │─── symbol and end withthe ───│ symbol.

v Required items are shown on the horizontal line (the main path):

►► keyword required_argument ►◄

v Optional items are shown below the main path:

►► keywordoptional_argument

►◄

v If you can choose from two or more items, they are shown vertically, in a stack.If you must choose one of the items, one item of the stack is shown on the mainpath.

►► keyword required_argument1required_argument2

►◄

If choosing one of the items is optional, the entire stack is shown below themain path.

►► keywordoptional_argument1optional_argument2

►◄

v An arrow returning to the left above the main line (a repeat arrow) indicatesthat you can make more than one choice from the stacked items or repeat anitem. The separator character, if it is other than a blank, is also indicated:

►► ▼

,

keyword repeatable_argument ►◄

v The item that is the default is shown above the main path.

►► keyworddefault_argumentalternate_argument ►◄

v Keywords are shown in nonitalic letters and should be entered exactly as shown.v Variables are shown in italicized lowercase letters. They represent user-supplied

names or values.v If punctuation marks, parentheses, arithmetic operators, or other such symbols

are shown, you must enter them as part of the syntax.

Sample syntax diagram

The following syntax diagram example shows the syntax for the #pragmacomment directive.

viii XL C/C++: Getting Started

Page 11: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

►►(1) (2) (3) (4) (5) (9) (10)

# pragma comment ( compiler )datetimestamp

(6)copyrightuser (7) (8)

, " token_sequence "

►◄

Notes:

1 This is the start of the syntax diagram.

2 The symbol # must appear first.

3 The keyword pragma must appear following the # symbol.

4 The name of the pragma comment must appear following the keyword pragma.

5 An opening parenthesis must be present.

6 The comment type must be entered only as one of the types indicated:compiler, date, timestamp, copyright, or user.

7 A comma must appear between the comment type copyright or user, and anoptional character string.

8 A character string must follow the comma. The character string must beenclosed in double quotation marks.

9 A closing parenthesis is required.

10 This is the end of the syntax diagram.The following examples of the #pragma comment directive are syntactically correctaccording to the diagram shown above:

#pragma comment(date)#pragma comment(user)#pragma comment(copyright,"This text will appear in the module")

Example of a syntax statementEXAMPLE char_constant {a|b}[c|d]e[,e]... name_list{name_list}...

The following list explains the syntax statement:v Enter the keyword EXAMPLE.v Enter a value for char_constant.v Enter a value for a or b, but not for both.v Optionally, enter a value for c or d.v Enter at least one value for e. If you enter more than one value, you must put a

comma between each.v Optionally, enter the value of at least one name for name_list. If you enter more

than one value, you must put a comma between each name.

Note: The same example is used in both the syntax-statement and syntax-diagramrepresentations.

Examples in this information

The examples in this information, except where otherwise noted, are coded in asimple style that does not try to conserve storage, check for errors, achieve fastperformance, or demonstrate all possible methods to achieve a specific result.

The examples for installation information are labelled as either Example or Basicexample. Basic examples are intended to document a procedure as it would be

About this document ix

Page 12: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

performed during a default installation; these need little or no modification.

Related informationThe following sections provide related information for XL C/C++:

Available help informationIBM XL C/C++ information

XL C/C++ provides product information in the following formats:v Quick Start Guide

The Quick Start Guide (quickstart.pdf) is intended to get you started with IBMXL C/C++ for AIX, V16.1. It is located by default in the XL C/C++ directoryand in the \quickstart directory of the installation DVD.

v README filesREADME files contain late-breaking information, including changes andcorrections to the product information. README files are located by default inthe XL C/C++ directory and in the root directory of the installation DVD.

v Installable man pagesMan pages are provided for the compiler invocations and all command-lineutilities provided with the product. Instructions for installing and accessing theman pages are provided in the IBM XL C/C++ for AIX, V16.1 Installation Guide.

v Online product documentationThe fully searchable HTML-based documentation is viewable in IBM KnowledgeCenter at http://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.compilers.aix.doc/welcome.html.

v PDF documentsPDF documents are available on the web at https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.compilers.aix.doc/download_pdf.html.The following files comprise the full set of XL C/C++ product information.

Note: To ensure that you can access cross-reference links to other XL C/C++PDF documents, download and unzip the .zip file that contains all the productdocumentation files, or you can download each document into the samedirectory on your local machine.

Table 3. XL C/C++ PDF files

Document title PDF file name Description

What's New for IBM XLC/C++ for AIX, V16.1,GC27-8053-00

whats_new.pdf Provides an executive overview of newfunctions in the IBM XL C/C++ forAIX, V16.1 compiler, with newfunctions categorized according to userbenefits.

Getting Started withIBM XL C/C++ for AIX,V16.1, SC27-8055-00

getstart.pdf Contains an introduction to XL C/C++,with information about setting up andconfiguring your environment,compiling and linking programs, andtroubleshooting compilation errors.

x XL C/C++: Getting Started

Page 13: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Table 3. XL C/C++ PDF files (continued)

Document title PDF file name Description

IBM XL C/C++ for AIX,V16.1 Installation Guide,SC27-8058-00

install.pdf Contains information for installing XLC/C++ and configuring yourenvironment for basic compilation andprogram execution.

IBM XL C/C++ for AIX,V16.1 Migration Guide,GC27-8051-00

migrate.pdf Contains migration considerations forusing XL C/C++ to compile programsthat were previously compiled ondifferent platforms, by previous releasesof XL C/C++, or by other compilers.

IBM XL C/C++ for AIX,V16.1 CompilerReference, SC27-8057-00

compiler.pdf Contains information about the variouscompiler options, pragmas, macros,environment variables, and built-infunctions, including those used forparallel processing.

IBM XL C/C++ for AIX,V16.1 LanguageReference, SC27-8059-00

langref.pdf Contains information about the C andC++ programming languages, assupported by IBM, including languageextensions for portability andconformance to nonproprietarystandards.

IBM XL C/C++ for AIX,V16.1 Optimization andProgramming Guide,SC27-8060-00

proguide.pdf Contains information about advancedprogramming topics, such asapplication porting, interlanguage callswith Fortran code, library development,application optimization andparallelization, and the XL C/C++high-performance libraries.

Standard C++ LibraryReference, SC27-4262-02

standlib.pdf Contains reference information aboutthe standard C++ runtime libraries andheaders.

C/C++ Legacy ClassLibraries Reference,SC09-7652-00

legacy.pdf Contains reference information aboutthe USL I/O Stream Library and theComplex Mathematics Library.

To read a PDF file, use Adobe Reader. If you do not have Adobe Reader, youcan download it (subject to license terms) from the Adobe website athttp://www.adobe.com.

More information related to XL C/C++, including IBM Redbooks® publications,white papers, and other articles, is available on the web at http://www.ibm.com/support/docview.wss?uid=swg27036618.

For more information about the compiler, see the XL compiler on Power®

community at http://ibm.biz/xl-power-compilers.

Other IBM informationv Parallel Environment for AIX: Operation and Use

v The IBM Systems Information Center, at http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.doc/doc/base/aixparent.htm,is a resource for AIX information.You can find the following books for your specific AIX system:– AIX Commands Reference, Volumes 1 - 6

About this document xi

Page 14: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

– Technical Reference: Base Operating System and Extensions, Volumes 1 & 2

– AIX National Language Support Guide and Reference

– AIX General Programming Concepts: Writing and Debugging Programs

– AIX Assembler Language Reference

Other informationv Using the GNU Compiler Collection available at http://gcc.gnu.org/onlinedocs.

Standards and specificationsXL C/C++ is designed to support the following standards and specifications. Youcan refer to these standards and specifications for precise definitions of some of thefeatures found in this information.v Information Technology - Programming languages - C, ISO/IEC 9899:1990, also

known as C89.v Information Technology - Programming languages - C, ISO/IEC 9899:1999, also

known as C99.v xlclang/xlclang++ Information Technology - Programming languages - C, ISO/IEC

9899:2011, also known as C11.v xlc/xlC Information Technology - Programming languages - C, ISO/IEC 9899:2011,

also known as C11 (Partial support).v Information Technology - Programming languages - C++, ISO/IEC 14882:1998, also

known as C++98.v Information Technology - Programming languages - C++, ISO/IEC 14882:2003, also

known as C++03.v xlclang/xlclang++ Information Technology - Programming languages - C++, ISO/IEC

14882:2011, also known as C++11.v xlc/xlC Information Technology - Programming languages - C++, ISO/IEC 14882:2011,

also known as C++11 (Partial support).v xlclang/xlclang++ Information Technology - Programming languages - C++, ISO/IEC

14882:2014, also known as C++14.v xlc/xlC Draft Technical Report on C++ Library Extensions, ISO/IEC DTR 19768. This

draft technical report has been submitted to the C++ standards committee, andis available at http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1836.pdf.

v AltiVec Technology Programming Interface Manual, Motorola Inc. This specificationfor vector data types, to support vector processing technology, is available athttp://www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPIM.pdf.

v xlc/xlC Information Technology - Programming Languages - Extension for theprogramming language C to support decimal floating-point arithmetic, ISO/IEC WDTR24732. This draft technical report has been submitted to the C standardscommittee, and is available at http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1176.pdf.

v xlc/xlC Decimal Types for C++: Draft 4 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1977.html

v ANSI/IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985.

xii XL C/C++: Getting Started

Page 15: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Technical supportAdditional technical support is available from the XL C/C++ Support page athttps://www.ibm.com/mysupport/s/topic/0TO0z0000006v6TGAQ/xl-cc?productId=01t0z000007g72LAAQ. This page provides a portal with searchcapabilities to a large selection of Technotes and other support information.

If you have any question on the product, raise it in the XL C, C++, and FortranCompilers for Power servers community or open a case at https://www.ibm.com/mysupport/s/topic/0TO0z0000006v6TGAQ/xl-cc?productId=01t0z000007g72LAAQ.

For the latest information about XL C/C++, visit the product information site athttps://www.ibm.com/us-en/marketplace/xl-cpp-aix-compiler-power.

How to send your commentsYour feedback is important in helping us to provide accurate and high-qualityinformation. If you have any comments or questions about this information or anyother XL C/C++ information, send [email protected] an email.

Be sure to include the name of the manual, the part number of the manual, theversion of XL C/C++, and, if applicable, the specific location of the text you arecommenting on (for example, a page number or table number).

About this document xiii

Page 16: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

xiv XL C/C++: Getting Started

Page 17: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Chapter 1. Introducing XL C/C++

IBM XL C/C++ for AIX, V16.1 is an advanced, high-performance compiler that canbe used for developing complex, computationally intensive programs, includinginterlanguage calls with C and Fortran programs.

This section contains information about the features of the XL C/C++ compiler at ahigh level. It is intended for people who are evaluating the compiler and for newusers who want to find out more about the product.

A two-in-one compiler: Clang-based front end and XL-based front endIn addition to the legacy IBM XL-based compiler front end, IBM XL C/C++ forAIX, V16.1 provides a Clang-based front end, which supplies enhanced C and C++language standards support and GCC compatibility. The Clang-based front endand the advanced optimization technology in the IBM compiler back end arecombined in XL C/C++.

You must specify the correct invocation command to invoke the desired front end.For example:v Use xlc and xlC to invoke the XL-based front end.v Use xlclang and xlclang++ to invoke the Clang-based front end.

For the full list of compiler invocation commands, see Invoking the compiler.

For differences between the XL-based front end and the Clang-based front end, seeComparison between XL-based and Clang-based front ends in XL C/C++ MigrationGuide.

Clang is a component of the LLVM open source compiler and toolchain project andprovides the C and C++ language family front end for LLVM. For additionalinformation about Clang, see the LLVM web site at: http://clang.llvm.org/.

Commonality with other IBM compilersIBM XL C/C++ for AIX, V16.1 is part of a larger family of IBM C, C++, andFortran compilers. XL C/C++, together with XL C and XL Fortran, comprises thefamily of XL compilers.

These compilers are derived from a common code base that shares compilerfunction and optimization technologies for a variety of platforms andprogramming languages. Programming environments include IBM AIX, IBM BlueGene/Q™, IBM i, selected Linux distributions, IBM z/OS®, and IBM z/VM®. Thecommon code base, along with compliance with international programminglanguage standards, helps support consistent compiler performance and ease ofcode portability across multiple operating systems and hardware platforms.

© Copyright IBM Corp. 1996, 2018 1

Page 18: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Operating system and hardware supportThis section describes the operating systems and hardware that IBM XL C/C++ forAIX, V16.1 supports.

IBM XL C/C++ for AIX, V16.1 supports the following operating systems:v IBM AIX V7.1 TL4v IBM AIX V7.2v IBM i V7.3 PASE V7.3

See "Prerequisites" in the XL C/C++ Installation Guide for a complete list ofrequirements.

The compiler, its libraries, and its generated object programs run on POWER5,POWER5+, POWER6®, POWER7®, POWER7+™, POWER8®, and POWER9™ systemswith the required software and disk space.

To exploit the various supported hardware configurations, the compiler providesoptions to tune the performance of applications according to the hardware typethat runs the compiled applications.

A highly configurable compilerYou can use a variety of compiler invocation commands and options to tailor thecompiler to your unique compilation requirements.

Compiler invocation commands

XL C/C++ provides several commands to invoke the compiler, for example, xlC,xlc++, and xlc. Compiler invocation commands are provided to support moststandardized C/C++ language levels and many popular language extensions.

xlc/xlC The compiler also provides corresponding _r versions of most invocationcommands, for example, xlc_r and xlC_r. The _r invocations instruct the compilerto link and bind object files to threadsafe components and libraries, and producethreadsafe object code for compiler-created data and procedures. xlc/xlC

xlclang/xlclang++ The xlclang and xlclang++ are invocation commands for theClang-based front end. They are threadsafe to compile parallelized applications inmultiprocessor environments. xlclang/xlclang++

For more information about XL C/C++ compiler invocation commands, see"Invoking the compiler" in the XL C/C++ Compiler Reference.

Compiler options

You can choose from a large selection of compiler options to control compilerbehavior. You can benefit from using different options for the following tasks:v Debugging your applicationsv Optimizing and tuning application performancev Selecting language levels and extensions for compatibility with nonstandard

features and behaviors that are supported by other C or C++ compilersv Performing many other common tasks that would otherwise require changing

the source code

2 XL C/C++: Getting Started

Page 19: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

You can specify compiler options through a combination of environment variables,compiler configuration files, command line options, and compiler directivestatements embedded in your program source.

For more information about XL C/C++ compiler options, see "Compiler optionsreference" in the XL C/C++ Compiler Reference.

Custom compiler configuration files

The installation process creates a default plain text compiler configuration filecontaining stanzas that define compiler option default settings.

If you frequently specify compiler option settings other than the default settings ofXL C/C++, you can use makefiles to define your settings. Alternatively, you cancreate custom configuration files to define your own frequently used optionsettings.

For more information about using custom compiler configuration files, see “Usingcustom compiler configuration files” on page 11.

Utilization tracking configuration file

The utilization and reporting tool can be used to detect whether yourorganization's use of the compiler exceeds your license entitlements.

The utilization tracking and reporting feature of the compiler has its ownconfiguration file. The main compiler configuration file contains an entry thatpoints to this file. The different installations of the compiler product can use asingle utilization tracking configuration file to centrally manage the utilizationtracking and reporting feature.

For detailed information about the utilization tracking and reporting feature, see"Tracking and reporting compiler usage" in the XL C/C++ Compiler Reference.

Language standard complianceThis topic describes the C/C++ programming language specifications that IBM XLC/C++ for AIX, V16.1 supports.

C language specifications

v xlclang/xlclang++ ISO/IEC 9899:2011 (referred to as C11)v xlc/xlC Partial support for ISO/IEC 9899:2011 (referred to as C11)v ISO/IEC 9899:1999 (referred to as C99)v ISO/IEC 9899:1990 (referred to as C89)

C++ language specifications

v xlclang/xlclang++ ISO/IEC 14882:2014 (referred to as C++14)v xlclang/xlclang++ ISO/IEC 14882:2011 (referred to as C++11)v xlc/xlC Partial support for ISO/IEC 14882:2011 (referred to as C++11)v ISO/IEC 14882:2003 (referred to as C++03)v ISO/IEC 14882:1998, the first official specification of the C++ language (referred

to as C++98)

Chapter 1. Introducing XL C/C++ 3

Page 20: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

In addition to the standard language levels, XL C/C++ supports the followinglanguage extensions:v Language extensions to support vector programmingv A subset of GNU C and C++ language extensions

See "Language levels and language extensions" in the XL C/C++ Language Referencefor more information about C/C++ language specifications and extensions.

Compatibility with GNUXL C/C++ supports a subset of the GNU compiler command options to facilitateporting applications that are developed with the gcc and g++ compilers. However,no binary compatibility between code generated by IBM XL C/C++ for AIX andGCC is provided. You cannot mix and match binaries generated by gcc or g++ andthose by IBM XL C/C++ for AIX.

When using the XL-based front end

The compatibility support is available when the gxlc or gxlc++ invocationcommand is used together with select GNU compiler options. Where possible, thecompiler maps GNU options to their XL C/C++ compiler option counterpartsbefore invoking the compiler.

The invocation commands use a plain text configuration file to control GNU-to-XLC/C++ option mappings and defaults. You can customize this configuration file tomeet your unique compilation requirements. For more information, see "ReusingGNU C/C++ compiler options with gxlc and gxlc++" in the XL C/C++ CompilerReference.

When using the Clang-based front end

IBM XL C/C++ for AIX, V16.1, by introducing the Clang-based front end, providesa greater level of GNU source compatibility than previous releases. You can use theGCC options listed in Supported GCC options and GCC pragmas listed inSupported GCCpragmas in the XL C/C++ Compiler Reference with XL C/C++that is invoked by xlclang/xlclang++.

Source-code migration and conformance checkingXL C/C++ provides compiler invocation commands that instruct the compiler tocompile your application code to a specific language level.

You can also use the -qlanglvl compiler option to specify a language level. If thelanguage or language extension elements in your program source do not conformto the specified language level, the compiler issues diagnostic messages. You areencouraged to use the -std option when you use the Clang-based front end of IBMXL C/C++ for AIX, V16.1, which is invoked by xlclang/xlclang++.

Related information

-qlanglvl

LibrariesXL C/C++ includes a runtime environment that contains a number of libraries.

4 XL C/C++: Getting Started

Page 21: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Standard C++ library

The XL-based front end of IBM XL C/C++ for AIX, which is invoked by xlc/xlC,ships a modified version of the Dinkum C++ Library, a conformingimplementation of the Standard C++ Library. The Standard C++ Library consists of51 headers, including 13 headers which constitute the Standard Template Library(STL). In addition, the Standard C++ Library works with the 18 headers from theStandard C Library. The functions in these headers perform essential services suchas input and output. They also provide efficient implementations of frequentlyused operations.

The Clang-based front end of IBM XL C/C++ for AIX, which is invoked byxlclang/xlclang++, is based on the LLVM libc++ Library. The library is animplementation of the C++ standard library, targeting C++11, C++14, and above.

For more information, see the Standard C++ Library Reference.

C++ library extensions

In addition to the Standard C++ Library, XL C/C++ V16.1 supports manyextensions to the C++ language as defined by the Draft Technical Report on C++Library Extensions (TR1).

For more information about these language extensions, see Draft Technical Reporton C++ Library Extensions (TR1).

Mathematical Acceleration Subsystem library

The Mathematical Acceleration Subsystem (MASS) library consists of scalar andvector mathematical built-in functions tuned specifically for optimum performanceon supported processor architectures. You can choose a MASS library to supporthigh-performance computing on a broad range of processors, or you can select alibrary tuned to support a specific processor family.

The MASS library functions support both 32-bit and 64-bit compilation modes andoffer improved performance over the default libm math library routines. Theselibraries are threadsafe and are called automatically when you request specificlevels of optimization for your application. You can also make explicit calls toMASS library functions, whether optimization options are in effect or not.

For more information, see "Using the Mathematical Acceleration Subsystem" in theXL C/C++ Optimization and Programming Guide.

Basic Linear Algebra Subprograms

The Basic Linear Algebra Subprograms (BLAS) set of high-performance algebraicfunctions are shipped in the libxlopt library. You can use these functions to:v Compute the matrix-vector product for a general matrix or its transpose.v Perform combined matrix multiplication and addition for general matrices or

their transposes.

For more information about using the BLAS functions, see "Using the Basic LinearAlgebra Subprograms" in the XL C/C++ Optimization and Programming Guide.

Chapter 1. Introducing XL C/C++ 5

Page 22: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Support for Boost libraries

IBM XL C/C++ for AIX, V16.1 provides partial support for the Boost V1.59.0libraries. A patch file is available that modifies the Boost V1.59.0 libraries so thatthey can be built and used with XL C/C++ applications. The patch or modificationfile does not extend nor provide additional functionality to the Boost libraries.

To access the patch file for building the Boost libraries, go to Boost LibraryRegression Test Summaries (http://www.ibm.com/support/docview.wss?uid=swg27006911) and select download required Boost modificationfile for your compiler release and platform.

IBM XL C/C++ for AIX does not ship the Boost libraries, but you can downloadthe latest Boost libraries at http://www.boost.org/.

Other libraries

The following libraries are also shipped with XL C/C++:v The SMP runtime library supports both explicit and automated parallel

processing. See "SMP Runtime Library" in the XL C/C++ Optimization andProgramming Guide.

v The memory debug runtime library is used for diagnosing memory leaks. See"Using memory heaps" in the XL C/C++ Optimization and Programming Guide.

v XL C++ Runtime Library contains support routines needed by the compiler.v UNIX System Laboratories (USL) contains stream classes for input and output

capabilities for C++. This library is provided for use by old applications. Fornew applications, use the Standard C++ Library for portability. See C/C++ LegacyClass Libraries Reference for more information.

v USL contains classes for manipulating complex numbers. This library isprovided for use by old applications. For new applications, use the StandardC++ Library for portability. See C/C++ Legacy Class Libraries Reference for moreinformation.

v C++ The demangler library provides routines and classes for demanglinglinkage names created by the C++ compiler.

For more information about support for libraries, search on the XL C/C++Compiler support page at https://www.ibm.com/mysupport/s/topic/0TO0z0000006v6TGAQ/xl-cc?productId=01t0z000007g72LAAQ.

Tools, utilities, and commandsThis topic introduces the main tools, utilities, and commands that are includedwith XL C/C++. It does not contain all compiler tools, utilities, and commands.

Tools

Utilization reporting tool

The utilization reporting tool generates a report describing yourorganization's utilization of the compiler. These reports help determinewhether your organization's use of the compiler matches your compilerlicense entitlements. The urt command contains options that can be used tocustomize the report. For more information, see Tracking and reportingcompiler usage in the XL C/C++ Compiler Reference.

6 XL C/C++: Getting Started

Page 23: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Utilities

C++ c++filt name demangling utilityThe c++filt name demangling utility converts the mangled names to theiroriginal source code names. When XL C/C++ compiles a C++ program, itencodes all function names and certain other identifiers to include typeand scoping information. This encoding process is called mangling. Formore information, see Demangling compiled C++ names in the XL C/C++Optimization and Programming Guide. C++

CreateExportList utilityThe CreateExportList utility creates a file that contains a list of all theexportable symbols found in a given set of object files. For moreinformation, see Exporting symbols with the CreateExportList utility in theXL C/C++ Optimization and Programming Guide.

C++ linkxlC utilityThe linkxlC utility links C++ .o and .a files. It is used for linking onsystems where the XL C/C++ compiler is not installed. For moreinformation, see Linking with the linkxlC utility in the XL C/C++Optimization and Programming Guide. C++

C++ makeC++SharedLib utilityThe makeC++SharedLib utility permits the creation of C++ sharedlibraries on systems where the XL C/C++ compiler is not installed. Formore information, see Creating a shared library with themakeC++SharedLib utility in the XL C/C++ Optimization and ProgrammingGuide. C++

Commands

xlc/xlC genhtml commandThe genhtml command converts an existing XML diagnostic reportproduced by the -qlistfmt option. You can choose to produce XML orHTML diagnostic reports by using the -qlistfmt option. The report canhelp you find optimization opportunities. For more information about howto use this command, see genhtml command in the XL C/C++ CompilerReference.

Profile-directed feedback (PDF) related commands

cleanpdf commandThe cleanpdf command removes all the PDF files or the specifiedPDF files from the directory to which profile-directed feedbackdata is written.

mergepdf commandThe mergepdf command weighs the importance of two or morePDF records when combining them into a single record. The PDFrecords must be derived from the same executable.

showpdf commandThe showpdf command displays the following types of profilinginformation for all the procedures executed in a PDF run(compilation under the -qpdf1 option):v Block-counter profilingv Call-counter profilingv Value profiling

Chapter 1. Introducing XL C/C++ 7

Page 24: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

v Cache-miss profiling, if you specified the -qpdf1=level=2 optionduring the PDF1 step.

You can view the first two types of profiling information in eithertext or XML format. However, you can view value profiling andcache-miss profiling information only in XML format.

For more information, see cleanpdf, mergepdf, and showpdf in the XLC/C++ Compiler Reference.

xlCndiThe xlCndi script installs XL C/C++ to a nondefault directory location. Formore information, see Updating an advanced installation using xlCndi inthe XL C/C++ Installation Guide.

Program optimizationXL C/C++ provides several compiler options that can help you control theoptimization and performance of your programs.

With these options, you can perform the following tasks:v Select different levels of compiler optimizations.v Control optimizations for loops, floating point, and other types of operations.v Optimize a program for a particular class of machines or for a specific machine

configuration, depending on where the program will run.

Optimizing transformations can give your application better overall executionperformance. XL C/C++ provides a portfolio of optimizing transformationstailored to various supported hardware. These transformations offer the followingbenefits:v Reducing the number of instructions executed for critical operationsv Restructuring generated object code to make optimal use of the Power

Architecture® processorsv Improving the usage of the memory subsystemv Exploiting the ability of the architecture to handle large amounts of shared

memory parallelizationRelated information

Optimizing your applications

Optimization and tuning

Compiler built-in functions

64-bit object capabilityThe 64-bit object capability of the XL C/C++ compiler addresses increasingdemand for larger storage requirements and greater processing power.

The AIX operating system provides an environment that allows you to developand execute programs that exploit 64-bit processors through the use of 64-bitaddress spaces.

To support larger executables that can fit within a 64-bit address space, a separate64-bit object format is used. The binder binds these objects to create 64-bit

8 XL C/C++: Getting Started

Page 25: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

executables. Objects that are bound together must all be of the same object format.The following scenarios are not permitted and will fail to load, execute, or both:v A 64-bit object or executable that has references to symbols from a 32-bit library

or shared libraryv A 32-bit object or executable that has references to symbols from a 64-bit library

or shared libraryv A 64-bit executable that explicitly attempts to load a 32-bit modulev A 32-bit executable that explicitly attempts to load a 64-bit modulev Attempts to run 64-bit applications on 32-bit platforms

On both 64-bit and 32-bit platforms, 32-bit executables will continue to run as theycurrently do on a 32-bit platform.

XL C/C++ supports 64-bit mode mainly through the use of the -q64 and -qarchcompiler options. This combination determines the bit mode and instruction set forthe target architecture.

For more information, see "Using 32-bit and 64-bit modes" in the XL C/C++Optimization and Programming Guide.

Shared memory parallelizationXL C/C++ supports application development for multiprocessor systemarchitectures.

You can use any of the following methods to develop your parallelizedapplications with XL C/C++:

v xlc/xlC Directive-based shared memory parallelization (OpenMP, SMP)v Instructing the compiler to automatically generate shared memory

parallelizationv Message-passing-based shared or distributed memory parallelization (MPI)v POSIX threads (Pthreads) parallelizationv Low-level UNIX parallelization using fork() and exec()

The parallel programming facilities are based on the concept of threads. Parallelprogramming exploits the advantages of multiprocessor systems while maintaininga full binary compatibility with existing uniprocessor systems. This means that amultithreaded program that works on a uniprocessor system can take advantage ofa multiprocessor system without recompiling.

For more information, see "Parallelizing your programs" in the XL C/C++Optimization and Programming Guide.

OpenMP directives

OpenMP directives are a set of API-based commands supported by XL C/C++ andmany other IBM and non-IBM C, C++, and Fortran compilers.

You can use OpenMP directives to instruct the compiler how to parallelize aparticular block of code. The existence of the directives in the source removes theneed for the compiler to perform any dependence analysis on the parallel code.OpenMP directives require the presence of Pthread libraries to provide thenecessary infrastructure for parallelization.

Chapter 1. Introducing XL C/C++ 9

Page 26: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

OpenMP directives address the following important issues of parallelizing anapplication:

1. Clauses and directives are available for scoping variables. Generally,variables should not be shared; that is, each thread should have its owncopy of the variable.

2. Work sharing directives specify how the work contained in a parallelregion of code should be distributed across the threads.

3. Directives are available to control synchronization between threads.

xlc/xlC IBM XL C/C++ for AIX, V16.1 provides full support for the OpenMP APIVersion 3.1 and partial support for the OpenMP API Version 4.0 specification forshared memory parallel programming. xlc/xlC

Note: When you invoke the Clang-based front end of IBM XL C/C++ for AIX,V16.1 using the xlclang or xlclang++ invocation command, OpenMP programmingis not supported.

Related information

Optimizing your applications

The OpenMP API specification for parallel programming

Diagnostic reportsThe compiler listings, XML reports, and HTML reports provide importantinformation to help you develop and debug your applications more efficiently.When you invoke the Clang-based front end of IBM XL C/C++ for AIX, V16.1using the xlclang or xlclang++ invocation command, diagnostic reports generatingis not supported..

Listing information is organized into optional sections that you can include oromit. For more information about the applicable compiler options and the listingitself, see "Compiler messages and listings" in the XL C/C++ Compiler Reference.

You can also obtain diagnostic information from the compiler in XML or HTMLformat. The XML and HTML reports provide information about optimizations thatthe compiler performed or could not perform. You can use this information toreduce programming effort when tuning applications, especially high-performanceapplications. The report is defined by an XML schema and is easily consumable bytools that you can create to read and analyze the results. For detailed informationabout this report and how to use it, see "Using reports to diagnose optimizationopportunities" in the XL C/C++ Optimization and Programming Guide.

Symbolic debugger supportYou can instruct XL C/C++ to include debugging information in your compiledobjects by using different levels of the -g compiler option.

The debugging information can be examined by dbx or any symbolic debuggerthat supports the AIX XCOFF executable format to help you debug your programs.

Related information

-g

10 XL C/C++: Getting Started

Page 27: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Chapter 2. Setting up and customizing XL C/C++

This section describes how to set up and customize the compiler according to yourown requirements.

For complete prerequisite and installation information for XL C/C++, see "Beforeinstalling XL C/C++" in the XL C/C++ Installation Guide.

Using custom compiler configuration filesYou can customize compiler settings and options by modifying the defaultconfiguration file or creating your own configuration file.

You have the following options to customize compiler settings:v The XL C/C++ compiler installation process creates a default compiler

configuration file. You can directly modify this configuration file to add defaultoptions for specific needs. However, if you later apply updates to the compiler,you must reapply all of your modifications to the newly installed configurationfile.

v You can create your own custom configuration file that either overrides orcomplements the default configuration file. The compiler can recognize andresolve compiler settings that you specify in your custom configuration fileswith compiler settings that are specified in the default configuration file.Compiler updates that might later affect settings in the default configuration filedo not affect the settings in your custom configuration files.Related information

Using custom compiler configuration files

Configuring compiler utilization tracking and reportingIn addition to the compiler configuration file, there is a separate configuration filefor the utilization tracking and reporting feature. Utilization tracking is disabled bydefault, but you can enable it by modifying an entry in this configuration file.Various other aspects of utilization tracking can also be configured using this file.

Although the compiler configuration file is separate from the utilization trackingconfiguration file, it contains an entry that specifies the location of the utilizationtracking configuration file so that the compiler can find this file.

For more information about how to configure the utilization tracking and reportingfeature, see Tracking and reporting compiler usage in the XL C/C++ CompilerReference.

© Copyright IBM Corp. 1996, 2018 11

Page 28: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

12 XL C/C++: Getting Started

Page 29: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Chapter 3. Developing applications with XL C/C++

C/C++ application development consists of repeating cycles of editing, compiling,linking, and running. By default, compiling and linking are combined into a singlestep.

Notes:

v Before you use the compiler, ensure that XL C/C++ is properly installed andconfigured. For more information, see the XL C/C++ Installation Guide.

v To learn about writing C/C++ programs, refer to the XL C/C++ LanguageReference and the C and C++ language standards.

Compiler phasesA typical compiler invocation executes some or all of these activities in sequence.For link time optimizations, some activities are executed more than once during acompilation. As each compilation component runs, the results are sent to the nextstep in the sequence.1. Preprocessing of source files2. Compilation, which might consist of the following phases, depending on what

compiler options are specified:a. Front-end parsing and semantic analysisb. High-level optimizationc. Low-level optimizationd. Register allocatione. Final assembly

3. Assembling the assembly (.s) files and the unpreprocessed assembler (.S) filesafter they are preprocessed

4. Object linking to create an executable application

To see the compiler step through these phases, specify the -v compiler option whenyou compile your application. To see the amount of time the compiler spends ineach phase, specify -qphsinfo.

Editing C/C++ source filesTo create C/C++ source programs, you can use any text editor available on yoursystem, such as vi or emacs.

Source programs must be saved using a recognized file name suffix. See “XLC/C++ input and output files” on page 16 for a list of suffixes recognized by XLC/C++.

For a C or C++ source program to be a valid program, it must conform to thelanguage definitions specified in the XL C/C++ Language Reference and the C andC++ language standards.

© Copyright IBM Corp. 1996, 2018 13

Page 30: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Compiling with XL C/C++XL C/C++ is a command-line compiler. Invocation commands and options can beselected according to the needs of a particular C/C++ application.

Invoking the compilerThe compiler invocation commands perform all necessary steps to compile C/C++source files or preprocessed files (.i or .ii), assemble any .s and .S files, and linkthe object files and libraries into an executable program.

To compile a C source program, use the following basic invocation syntax:

►► xlcxlclang

▼ ▼ input_filecompiler_option

►◄

To compile a C++ source program, use the following basic invocation syntax:

►► xlCxlc++xlclang++

▼ ▼ input_filecompiler_option

►◄

Use xlc and xlC to invoke the XL-based front end, and use xlclang and xlclang++to invoke the Clang-based front end. You are encouraged to compile source codeand link the generated object files with the consistent invocation command.

For most applications, compile with xlc, xlC or a threadsafe counterpart. You canuse xlC to compile either C or C++ program source, but compiling C++ files withxlc might result in link or runtime errors because libraries required for C++ codeare not specified when the linker is called by the C compiler.

More invocation commands are available to meet specialized compilation needs,primarily to provide explicit compilation support for different levels andextensions of the C or C++ language.

For more information about available compiler invocation commands, includingspecial invocations that are intended to assist developers in migrating from a GNUcompilation environment to XL C/C++, see "Invoking the compiler" in the XLC/C++ Compiler Reference.

Compiling parallelized XL C/C++ applicationsXL C/C++ provides threadsafe compiler invocation commands to compileparallelized applications for use in multiprocessor environments.

These invocations are similar to their corresponding base compiler invocations,except that they link and bind compiled objects to threadsafe components andlibraries. The generic XL C/C++ threadsafe compiler invocations are as follows:

v xlC_r, xlC_r7, xlC128_r, xlC128_r7

14 XL C/C++: Getting Started

Page 31: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

v xlc++_r, xlc++_r7, xlc++128_r, xlc++128_r7v xlc_r, xlc_r7, xlc128_r, xlc128_r7v xlclang, xlclang++

XL C/C++ provides additional threadsafe invocations to meet specific compilationrequirements. For more information, see "Invoking the compiler" in the XL C/C++Compiler Reference. xlc/xlC

Note: Using any of these commands alone does not imply parallelization. For thecompiler to recognize SMP or OpenMP directives and activate parallelization, youmust also specify the -qsmp compiler option. In turn, you should specify the-qsmp option only when threadsafe invocations are used. When you specify-qsmp, the driver links the libraries that are specified on the smp libraries line inthe active stanza of the configuration file.

For more information about parallelized applications, see "Parallelizing yourprograms" in the XL C/C++ Optimization and Programming Guide. xlc/xlC

Specifying compiler optionsCompiler options perform various functions, such as setting compilercharacteristics, describing the object code to be produced, controlling the diagnosticmessages emitted, and performing some preprocessor functions.

You can specify compiler options in one or any combination of the following ways:v On the command linev In your source code using directive statementsv In a makefilev In the stanzas found in a compiler configuration file

You can also pass options to the linker, assembler, and preprocessor.

Priority sequence of compiler options

Option conflicts and incompatibilities might occur when multiple compiler optionsare specified. To resolve these conflicts in a consistent manner, the compiler appliesthe following general priority sequence to most options:1. Directive statements in your source file override command line settings.2. Compiler option settings on the command line override configuration file

settings.3. Configuration file settings override default settings.

Generally, if the same compiler option is specified more than once on thecommand line when the compiler is invoked, the last option specified prevails.

Note: Some compiler options, such as the -I option, do not follow the prioritysequence described above. The compiler searches any directories specified with -Iin the xlc.cfg file before it searches the directories specified with -I on thecommand line. The -I option is cumulative rather than preemptive.

Related information

Compiler options reference

Chapter 3. Developing applications with XL C/C++ 15

Page 32: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Reusing GNU C/C++ compiler optionsXL C/C++ includes various features to help you transition from GNU C/C++compilers to XL C/C++.

When using the XL-based front end

Each of the gxlc and gxlc++ utilities accepts GNU C or C++ compiler options andtranslates them into comparable XL C/C++ options. Both utilities use the XLC/C++ options to create an xlc or xlc++ invocation command, which is then usedto invoke the compiler. These utilities are provided to help you reuse makefilescreated for applications previously developed with GNU C/C++. However, to fullyexploit the capabilities of XL C/C++, you can use the XL C/C++ invocationcommands and their associated options.

When using the Clang-based front end

If you invoke XL C/C++ by using xlclang/xlclang++, you can use many GNUC/C++ compiler options directly. For the full list, see Supported GCC options inthe XL C/C++ Compiler Reference.

XL C/C++ input and output filesThe topic describes the file types that are recognized by XL C/C++.

For detailed information about these and additional file types used by thecompiler, see "Types of input files" in the XL C/C++ Compiler Reference and "Typesof output files" in the XL C/C++ Compiler Reference.

Table 4. Input file types

Filename extension Description

.a Archive or library files

.c C source files

.C, .cc, .cp, .cpp, .cxx, .c++ C++ source files

.i Preprocessed source files

.ii Preprocessed C++ source files

.o Object files

.s Assembler files

.S Unpreprocessed assembler files

.so Shared object files

Table 5. Output file types

Filename extension Description

a.out Default name for executable file created by the compiler

.d Target file suitable for inclusion in a makefile

.i Preprocessed source files

.lst Listing files

.o Object files

.s Assembler files

.so Shared object files

.u Make dependency files

16 XL C/C++: Getting Started

Page 33: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Linking your compiled applications with XL C/C++By default, you do not need to do anything special to link an XL C/C++ program.The compiler invocation commands automatically call the linker to produce anexecutable output file.

For example, you can use xlc++ to compile file1.C and file3.C to produce objectfiles file1.o and file3.o; after that, all object files, including file2.o, aresubmitted to the linker to produce one executable.xlc++ file1.C file2.o file3.C

Compiling and linking in separate steps

To produce object files that can be linked later, use the -c option.xlc++ -c file1.C # Produce one object file (file1.o)xlc++ -c file2.C file3.C # Or multiple object files (file1.o, file3.o)xlc++ file1.o file2.o file3.o # Link object files with default libraries

Related information

Linking

Constructing a library

Relinking an existing executable fileThe linker accepts executable files as input, so you can link an existing executablefile with updated object files.

You cannot, however, relink executable files that were previously linked using the-qipa option.

If you have a program consisting of several source files and only make localizedchanges to some of the source files, you do not necessarily have to compile eachfile again. Instead, you can include the executable file as the last input file whencompiling the changed files:

xlc -o mansion front_door.c entry_hall.c parlor.c sitting_room.c \master_bath.c kitchen.c dining_room.c pantry.c utility_room.c

vi kitchen.c # Fix problem in OVEN function

xlc -o newmansion kitchen.c mansion

Limiting the number of files to compile and link the second time reduces thecompilation time, disk activity, and memory use.

Dynamic and static linkingYou can use XL C/C++ to take advantage of the operating system facilities forboth dynamic and static linking.

Dynamic linking means that the code for some external routines is located andloaded when the program is first run. When you compile a program that usesshared libraries, the shared libraries are dynamically linked to your program bydefault. Dynamically linked programs take up less disk space and less virtualmemory if more than one program uses the routines in the shared libraries. Duringlinking, they do not require any special precautions to avoid naming conflicts with

Chapter 3. Developing applications with XL C/C++ 17

Page 34: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

library routines. They might perform better than statically linked programs ifseveral programs use the same shared routines at the same time. By using dynamiclinking, you can upgrade the routines in the shared libraries without relinking.This form of linking is the default and no additional options are needed.

Static linking means that the code for all routines called by your program becomespart of the executable file. Statically linked programs can be moved to run onsystems without the XL C/C++ runtime libraries. They might perform better thandynamically linked programs if they make many calls to library routines or callmany small routines. They do require some precautions in choosing names for dataobjects and routines in the program if you want to avoid naming conflicts withlibrary routines.

Note: Dynamically and statically linked programs might not work if you compilethem on one level of the operating system and run them on a different level of theoperating system.

Diagnosing link-time problemsYou can use AIX commands and linker options to address unresolved andduplicate symbols that you might encounter.

Unresolved symbols

When an external symbol cannot be resolved, a linker error is issued. The examplemessages are as follows:ld: 0711-317 ERROR: Undefined symbol: .function_nameld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

The most common reason of unresolved symbol errors is missing input files. Youcan take one of the following actions to locate the symbols and include the targetinput files in which the symbols are defined during linking:v Include all the supplied libraries during linking so that the linker can find where

the symbols are.v Use the nm command to list symbols in libraries or object files so that you can

find out the target input files.v Use the dump -Tv command to examine the deferred imported symbols, which

have [noIMid] value for the IMPid field in the output. You must resolve thosedeferred symbols to avoid unresolved symbols.

v Use one of the following linker options to generate linker log files and analyzethe log files to determine the libraries or object files that reference unresolvedsymbols. These options examine interdependent or redundant libraries that areused in error.– The -bnoquiet option writes each binder subcommand and its results to

standard output. It lists unresolved symbol references and the symbols thatare imported from the specified library modules.

– The -bmap:filename option generates an address map. Unresolved symbols arelisted at the top of the map, followed by imported symbols.

– The -bloadmap:filename option generates a linker log file. The linker log fileincludes information about all of the arguments passed to the linker, thenames of the shared objects, and the number of imported symbols. If anyunresolved symbol is found, the linker log file lists the object file or sharedobject that references the symbol.

18 XL C/C++: Getting Started

Page 35: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Duplicate symbols

When two or more functions in the linked object files have the same name, awarning message is issued. The example messages are as follows:ld: 0711-224 WARNING: Duplicate symbol: .function_nameld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

By default, the linker uses the first definition that it encounters, which might notproduce expected results. To fix this problem, you can rename the function ormake the function static.

C++ The use of template functions in C++ might generate duplicate symbols atlink time when the template is implicitly instantiated in multiple source files.xlc/xlC You can use the -qtemplateregistry option to fix this issue. When the

-qtemplateregistry option is specified, identical instantiations of the same templatein different compilation units are recorded but the redundant instantiations are notgenerated. C++ xlc/xlC

To find the symbols that are defined in multiple files, you can use the nmcommand.

Incompatible symbols

If a symbol with C++ linkage is defined in an object file that is generated byxlclang++ and referred to in an object file that is generated by xlC/xlc++, or viceverse, a linker error is issued. The example messages are as follows:ld: 0711-317 ERROR: Undefined symbol: .symbol_nameld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

Mangled names by the Clang-based front end of IBM XL C/C++ for AIX are asdefined in the Itanium C++ ABI. Object files generated by xlC/xlc++ and xlclang++are not interoperable.Related information:Developing and Porting C and C++ Applications on AIX

Running your compiled applicationAfter a program is compiled and linked, you can run the generated executable fileon the command line.

The default file name for the program executable file produced by the XL C/C++compiler is a.out. You can select a different name with the -o compiler option.

Avoid giving your program executable file the same name as system or shellcommands, such as test or cp, as you could accidentally execute the wrongcommand. If you do decide to name your program executable file with the samename as a system or shell command, execute your program by specifying the pathname to the directory in which your executable file resides, such as ./test.

To run a program, enter the name of the program executable file with runtimearguments on the command line.

Chapter 3. Developing applications with XL C/C++ 19

Page 36: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Canceling execution

To suspend a running program, press Ctrl+Z while the program is in theforeground. Use the fg command to resume running.

To cancel a running program, press Ctrl+C while the program is in the foreground.

Setting runtime options

You can use environment variable settings to control certain runtime options andbehaviors of applications created with the XL C/C++ compiler. Some environmentvariables do not control actual runtime behavior, but they can have an impact onhow your applications run.

For more information about environment variables and how they can affect yourapplications at run time, see the XL C/C++ Installation Guide.

Running compiled applications on other systems

In general, applications linked on a system using an earlier version of AIX can runwith more recent versions of AIX. However, applications linked on a system usinga newer version of AIX might not necessarily run with earlier versions of AIX.

If you want to run an application developed with the XL C/C++ compiler onanother system that does not install the compiler, you need to install a runtimeenvironment on that system or link your application statically.

You can obtain the latest XL C/C++ Runtime Environment images, together withlicensing and usage information, from the XL C/C++ for AIX support page.

XL C/C++ compiler diagnostic aidsXL C/C++ issues diagnostic messages when it encounters problems duringcompilation of your application. You can use these messages and other informationprovided in compiler output listings to help identify and correct such problems.

For more information about listing, diagnostics, and related compiler options thatcan help you resolve problems with your application, see the following topics inthe XL C/C++ Compiler Reference:v "Compiler messages and listings"v "Error checking and debugging options"v "Listings, messages, and compiler information options"

Debugging compiled applicationsYou can use a symbolic debugger to debug applications compiled with XL C/C++.

At compile time, you can use the -g or -qlinedebug option to instruct the XLC/C++ compiler to include debugging information in compiled output. For -g, youcan also use different levels to balance between debug capability and compileroptimization. For more information about the debugging options, see "Errorchecking and debugging" in the XL C/C++ Compiler Reference.

You can then use dbx or any symbolic debugger that supports the AIX XCOFFexecutable format to step through and inspect the behavior of your compiledapplication.

20 XL C/C++: Getting Started

Page 37: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Optimized applications pose special challenges when you debug your applications.If you need to debug an optimized application, you can consider using the -gNform of the -g option along with any optimization options. This form of the -goption provides different levels of tradeoff between full optimization and fulldebugging support, depending on the value of N. For more information aboutdebugging your optimized code, see "Debugging optimized code" in the XL C/C++Optimization and Programming Guide.

xlclang/xlclang++

-gN can be -g0, -g1, or -g2 only. xlclang/xlclang++

Refer to the following table for special notice about the debug support by theClang-based front end that is invoked by the xlclang or xlclang++ invocationcommand:

Scenario In stabstring format In dwarf format

For C cases Supported Supported

For C++ cases For complicated virtualfunctions, dbx may not ableto execute with commandcall or print.

xlclang++ supports basicdebug functionality whiledbx limitations might beencountered for newer C++features which dbx does notsupport.

Determining which level of XL C/C++ is being usedTo display the version and release level of XL C/C++ that you are using, invokethe compiler with the -qversion compiler option.

For example, to obtain detailed version information, enter the following command:xlc++ -qversion=verbose

Chapter 3. Developing applications with XL C/C++ 21

Page 38: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

22 XL C/C++: Getting Started

Page 39: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Appendix. Accessibility features for IBM XL C/C++ for AIX

Accessibility features assist users who have a disability, such as restricted mobilityor limited vision, to use information technology content successfully.

Accessibility features

IBM XL C/C++ for AIX uses the latest W3C Standard, WAI-ARIA 1.0(http://www.w3.org/TR/wai-aria/), to ensure compliance to US Section 508(http://www.access-board.gov/guidelines-and-standards/communications-and-it/about-the-section-508-standards/section-508-standards) and Web ContentAccessibility Guidelines (WCAG) 2.0 (http://www.w3.org/TR/WCAG20/). To takeadvantage of accessibility features, use the latest release of your screen reader incombination with the latest web browser that is supported by this product.

The IBM XL C/C++ for AIX online product documentation in IBM KnowledgeCenter is enabled for accessibility. The accessibility features of IBM KnowledgeCenter are described at IBM Knowledge Center help.

Keyboard navigation

This product uses standard navigation keys.

Interface information

You can use speech recognition software like a Text-to-speech (TTS) tool to viewthe output generated by the compiler.

The IBM XL C/C++ for AIX online product documentation is available in IBMKnowledge Center, which is viewable from a standard web browser.

PDF files have limited accessibility support. With PDF documentation, you can useoptional font enlargement, high-contrast display settings, and can navigate bykeyboard alone.

To enable your screen reader to accurately read syntax diagrams, source codeexamples, and text that contains the period or comma PICTURE symbols, youmust set the screen reader to speak all punctuation.

Related accessibility information

To learn the accessibility features of the operation systems that are supported byIBM XL C/C++ for AIX, see the following information:v IBM AIX (https://www.ibm.com/support/knowledgecenter/ssw_aix/

welcome?lang=en)v IBM i (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i/

welcome?lang=en)

In addition to standard IBM help desk and support websites, IBM has establisheda TTY telephone service for use by deaf or hard of hearing customers to accesssales and support services:

© Copyright IBM Corp. 1996, 2018 23

Page 40: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

TTY service 800-IBM-3383 (800-426-3383) (within North America)

IBM and accessibility

For more information about the commitment that IBM has to accessibility, see IBMAccessibility (www.ibm.com/able).

24 XL C/C++: Getting Started

Page 41: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Notices

Programming interfaces: Intended programming interfaces allow the customer towrite programs to obtain the services of IBM XL C/C++ for AIX.

This information was developed for products and services offered in the U.S.A.IBM may not offer the products, services, or features discussed in this document inother countries. Consult your local IBM representative for information on theproducts and services currently available in your area. Any reference to an IBMproduct, program, or service is not intended to state or imply that only that IBMproduct, program, or service may be used. Any functionally equivalent product,program, or service that does not infringe any IBM intellectual property right maybe used instead. However, it is the user's responsibility to evaluate and verify theoperation of any non-IBM product, program, or service.

IBM may have patents or pending patent applications covering subject matterdescribed in this document. The furnishing of this document does not give youany license to these patents. You can send license inquiries, in writing, to:

IBM Director of LicensingIBM CorporationNorth Castle Drive, MD-NC119Armonk, NY 10504-1785U.S.A.

For license inquiries regarding double-byte (DBCS) information, contact the IBMIntellectual Property Department in your country or send inquiries, in writing, to:

Intellectual Property LicensingLegal and Intellectual Property LawIBM Japan, Ltd.19-21, Nihonbashi-Hakozakicho, Chuo-kuTokyo 103-8510, Japan

The following paragraph does not apply to the United Kingdom or any othercountry where such provisions are inconsistent with local law:INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THISPUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHEREXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESSFOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express orimplied warranties in certain transactions, therefore, this statement may not applyto you.

This information could include technical inaccuracies or typographical errors.Changes are periodically made to the information herein; these changes will beincorporated in new editions of the publication. IBM may make improvementsand/or changes in the product(s) and/or the program(s) described in thispublication at any time without notice.

Any references in this information to non-IBM websites are provided forconvenience only and do not in any manner serve as an endorsement of those

© Copyright IBM Corp. 1996, 2018 25

Page 42: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

websites. The materials at those websites are not part of the materials for this IBMproduct and use of those websites is at your own risk.

IBM may use or distribute any of the information you supply in any way itbelieves appropriate without incurring any obligation to you.

Licensees of this program who want to have information about it for the purposeof enabling: (i) the exchange of information between independently createdprograms and other programs (including this one) and (ii) the mutual use of theinformation which has been exchanged, should contact:

Intellectual Property Dept. for Rational SoftwareIBM Corporation5 Technology Park DriveWestford, MA 01886U.S.A.

Such information may be available, subject to appropriate terms and conditions,including in some cases, payment of a fee.

The licensed program described in this document and all licensed materialavailable for it are provided by IBM under terms of the IBM Customer Agreement,IBM International Program License Agreement or any equivalent agreementbetween us.

Any performance data contained herein was determined in a controlledenvironment. Therefore, the results obtained in other operating environments mayvary significantly. Some measurements may have been made on development-levelsystems and there is no guarantee that these measurements will be the same ongenerally available systems. Furthermore, some measurements may have beenestimated through extrapolation. Actual results may vary. Users of this documentshould verify the applicable data for their specific environment.

Information concerning non-IBM products was obtained from the suppliers ofthose products, their published announcements or other publicly available sources.IBM has not tested those products and cannot confirm the accuracy ofperformance, compatibility or any other claims related to non-IBM products.Questions on the capabilities of non-IBM products should be addressed to thesuppliers of those products.

All statements regarding IBM's future direction or intent are subject to change orwithdrawal without notice, and represent goals and objectives only.

This information contains examples of data and reports used in daily businessoperations. To illustrate them as completely as possible, the examples include thenames of individuals, companies, brands, and products. All of these names arefictitious and any similarity to the names and addresses used by an actual businessenterprise is entirely coincidental.

COPYRIGHT LICENSE:

This information contains sample application programs in source language, whichillustrates programming techniques on various operating platforms. You may copy,modify, and distribute these sample programs in any form without payment toIBM, for the purposes of developing, using, marketing or distributing applicationprograms conforming to the application programming interface for the operating

26 XL C/C++: Getting Started

Page 43: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

platform for which the sample programs are written. These examples have notbeen thoroughly tested under all conditions. IBM, therefore, cannot guarantee orimply reliability, serviceability, or function of these programs. The sampleprograms are provided “AS IS”, without warranty of any kind. IBM shall not beliable for any damages arising out of your use of the sample programs.

Each copy or any portion of these sample programs or any derivative work, mustinclude a copyright notice as follows:

© (your company name) (year). Portions of this code are derived from IBM Corp.Sample Programs. © Copyright IBM Corp. 1998, 2018.

PRIVACY POLICY CONSIDERATIONS:

IBM Software products, including software as a service solutions, (“SoftwareOfferings”) may use cookies or other technologies to collect product usageinformation, to help improve the end user experience, or to tailor interactions withthe end user, or for other purposes. In many cases no personally identifiableinformation is collected by the Software Offerings. Some of our Software Offeringscan help enable you to collect personally identifiable information. If this SoftwareOffering uses cookies to collect personally identifiable information, specificinformation about this offering's use of cookies is set forth below.

This Software Offering does not use cookies or other technologies to collectpersonally identifiable information.

If the configurations deployed for this Software Offering provide you as customerthe ability to collect personally identifiable information from end users via cookiesand other technologies, you should seek your own legal advice about any lawsapplicable to such data collection, including any requirements for notice andconsent.

For more information about the use of various technologies, including cookies, forthese purposes, see IBM's Privacy Policy at http://www.ibm.com/privacy andIBM's Online Privacy Statement at http://www.ibm.com/privacy/details in thesection entitled “Cookies, Web Beacons and Other Technologies,” and the “IBMSoftware Products and Software-as-a-Service Privacy Statement” athttp://www.ibm.com/software/info/product-privacy.

TrademarksIBM, the IBM logo, and ibm.com are trademarks or registered trademarks ofInternational Business Machines Corp., registered in many jurisdictions worldwide.Other product and service names might be trademarks of IBM or other companies.A current list of IBM trademarks is available on the web at “Copyright andtrademark information” at http://www.ibm.com/legal/copytrade.shtml.

Adobe and the Adobe logo are either registered trademarks or trademarks ofAdobe Systems Incorporated in the United States, other countries, or both.

Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo,Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks orregistered trademarks of Intel Corporation or its subsidiaries in the United Statesand other countries.

Notices 27

Page 44: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Linux is a registered trademark of Linus Torvalds in the United States, othercountries, or both.

UNIX is a registered trademark of The Open Group in the United States and othercountries.

28 XL C/C++: Getting Started

Page 45: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

Index

Aaccessibility

interfaces 23keyboard navigation 23

Ccapabilities

64-bit objects 8code

dynamic linking 17static linking 17

compatibilityGNU 4

compilationactivities 13introduction 14SMP programs 14

compiler optionsconflicts 15specifying 15

customizationGNU 4

Ddebugging

applications 20options 20symbolic debuggers

options 10

Eexecution

applications 19

Ffile types

input files 16

Iinvocation

applications 19

Llanguages

extensions 3standards 3

linkingapplications 17

Oobject files

creating 17linking 17

optimizationprograms 8

Pperformance

optimizing transformations 8problem resolution

compiler options 20related links 20

programsrunning 19

Sshared memory parallelization

methods 9OpenMP directives 9

SMPcompiling 14

source filesediting 13suffixes 13

© Copyright IBM Corp. 1996, 2018 29

Page 46: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

30 XL C/C++: Getting Started

Page 47: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation
Page 48: XL C/C++: Getting Started · names, compiler options, and dir ectives. The compiler pr ovides basic invocation commands, xlc and xlC (xlc++), along with several other compiler invocation

IBM®

Product Number: 5765-J12; 5725-C72

Printed in USA

SC27-8055-00