HP aC++/HP C A.06.25 Programmer's Guide

Data Compatibility between C and C++...........................................................................247
HP aC++ Calling HP C.................................................................................................248
Using the extern "C" Linkage Specification...........................................................248
Syntax of extern "C"................................................................................................248
Examples of extern "C"...........................................................................................249
Differences in Argument Passing Conventions.....................................................249
The main() Function...............................................................................................249
Examples: HP aC++ Calling HP C..........................................................................250
Running the Example.......................................................................................251
HP C Calling HP aC++.................................................................................................251
Compiling and Running the Sample Programs.....................................................253
Calling HP FORTRAN 90 from HP aC++....................................................................253
The main() Function...............................................................................................254
Function Naming Conventions..............................................................................254
Using Reference Variables to Pass Arguments......................................................254
Example of Reference Variables as Arguments................................................254
Using extern "C" Linkage.......................................................................................255
Strings.....................................................................................................................255
Arrays.....................................................................................................................255
Files in FORTRAN..................................................................................................255
11 Distributing Your C++ Products...............................................................................................257
Applications that use HP aC++ Shared Libraries.............................................................257
Linking Your HP aC++ Libraries with Other Languages.................................................258
Installing your Application...............................................................................................258
HP aC++ Files You May Distribute...................................................................................259
Terms for Distribution of HP aC++ Files...........................................................................259
12 Migrating from HP C++ (cfront) to HP aC++............................................................................261
General Guidelines for Migration.....................................................................................261
Getting Started with Migration...................................................................................261
Writing Code for both Compilers................................................................................262
Explicit Loading and Unloading of Shared Libraries ................................................262
Memory Allocation......................................................................................................262
Command-Line Differences..............................................................................................262
New Command-Line Options.....................................................................................263
Obsolete Command-Line Options...............................................................................263
Changed Command-Line Options..............................................................................265
Migration Considerations when Debugging....................................................................266
Migration Considerations when Using Exception Handling...........................................266
Exception Handling is the Default..............................................................................267
Memory Allocation Failure and operator new............................................................267
Possible Differences when Exiting a Signal Handler..................................................268
18 Table of Contents