Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.60 -mt[={yes|no}]

Use this option to compile and link multithreaded code using the Oracle Solaris threads or POSIX threads API. The -mt=yes option assures that libraries are linked in the appropriate order.

This option passes -D_REENTRANT to the preprocessor.

On Linux platforms, only the POSIX threads API is available. (There is no libthread on Linux platforms.) Consequently, -mt=yes on Linux platforms adds -lpthread instead of -lthread. To use POSIX threads on Linux platforms, compile with -mt.

Note that when compiling with -G, neither -lthread nor -lpthread are automatically included by -mt=yes. You will need to explicitly list these libraries when building a shared library.

The -xopenmp option (for using the OpenMP shared-memory parallelization API) includes -mt=yes automatically.

If you compile with -mt=yes and link in a separate step, you must use the -mt=yes option in the link step as well as the compile step. If you compile and link one translation unit with -mt=yes, you must compile and link all units of the program with -mt=yes

-mt=yes is the default behavior of the compiler. If this behavior is not desired, compile with -mt=no.

The option -mt is equivalent to -mt=yes.