Sun Studio 12: C++ User's Guide

A.2.132 -xlang=language[,language]

Includes the appropriate runtime libraries and ensures the proper runtime environment for the specified language.

A.2.132.1 Values

language must be either f77, f90, f95, or c99.

The f90 and f95 arguments are equivalent. The c99 argument invokes ISO 9899:1999 C programming language behavior for objects that were compiled with cc -xc99=%all and are being linked with CC.


The -xlang=f90 and -xlang=f95 options imply -library=f90, and the -xlang=f77 option implies -library=f77. However, the -library=f77 and -library=f90 options are not sufficient for mixed-language linking because only the -xlang option ensures the proper runtime environment.

To determine which driver to use for mixed-language linking, use the following language hierarchy:

  1. C++

  2. Fortran 95 (or Fortran 90)

  3. Fortran 77

  4. C or C99

When linking Fortran 95, Fortran 77, and C++ object files together, use the driver of the highest language. For example, use the following C++ compiler command to link C++ and Fortran 95 object files.

example% CC -xlang=f95...

To link Fortran 95 and Fortran 77 object files, use the Fortran 95 driver, as follows.

example% f95 -xlang=f77...

You cannot use the -xlang option and the -xlic_lib option in the same compiler command. If you are using -xlang and you need to link in the Sun Performance Libraries, use -library=sunperf instead.


Do not use -xnolib with -xlang.

If you are mixing parallel Fortran objects with C++ objects, the link line must specify the -mt flag.

See also

-library, -staticlib