// pas_func should accept
// its parameters by reference

int main( void )

{

//declare a reference variable extern void pas_func( short & ); short x;

...

pas_func( x );

...

}

Using extern "C" Linkage

To mix C++ modules with HP FORTRAN 90 modules, you must use extern "C" linkage to declare any C++ functions that are called from a non-C++ module and to declare the FORTRAN routines.

Strings

HP aC++ strings are not the same as HP FORTRAN 90 strings. In FORTRAN 90, the strings are not null terminated. Also, strings are passed as string descriptors in FORTRAN 90. This means that the address of the character item is passed and a length by value follows.

NOTE: If you use the HP FORTRAN 90 +800 option, the length follows immediately after the character pointer in the parameter list. If you do not use this option, HP FORTRAN 90 passes character lengths by value at the end of the parameter list.

Refer the HP FORTRAN/9000 Programmer’s Reference Guide and HP FORTRAN/9000 Programmer’s Guide for information about the +800 option.

Arrays

HP aC++ stores arrays in row-major order, whereas HP FORTRAN 90 stores arrays in column-major order. The lower bound for HP aC++ is 0. The default lower bound for HP FORTRAN 90 is 1.

Files in FORTRAN

HP FORTRAN I/O routines require a logical unit number to access a file, whereas HP aC++ accesses files using HP-UX I/O subroutines and intrinsics and requires a stream pointer.

A FORTRAN logical unit cannot be passed to a C++ routine to perform I/O on the associated file; also a C++ file pointer cannot be used by a FORTRAN routine. However, a file created by a program written in either language can be used by a program of the other language if the file is declared open within the latter program. HP-UX I/O (stream I/O) can also be used from FORTRAN instead of FORTRAN I/O.

Refer to your system FORTRAN manual on inter-language calls for more information.

194 Mixing C++ with Other Languages