---
name: "MPI_Session_f2c"
section: "3"
platform: "linux"
package: "openmpi"
version: "5.0.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/MPI_Session_f2c"
---

# MPI\_Session\_f2c(3)

MPI\_Session\_c2f, *MPI\_Session\_f2c* - Translates a C session handle into a Fortran INTEGER-style session handle, or vice versa.

## SYNTAX

### C Syntax

```
#include <mpi.h>
int MPI_Session_f2c(const MPI_Fint *f_session, MPI_Session *c_session)
int MPI_Session_c2f(const MPI_Session *c_session, MPI_Fint *f_session)
```

## PARAMETERS

- •

  **f\_session**: **mpi**-style **INTEGER** MPI session object

- •

  **c\_session**: C-style MPI session object

## DESCRIPTION

These two procedures are provided in C to convert from a Fortran session (which is an array of integers) to a C session (which is a structure), and vice versa. The conversion occurs on all the information in **session**, including that which is hidden. That is, no session information is lost in the conversion.

When using MPI\_Session\_f2c(), if **f\_session** is a valid Fortran session, then MPI\_Session\_f2c() returns in **c\_session** a valid C session with the same content. If **f\_session** is the Fortran value of MPI\_SESSION\_NULL, or if **f\_session** is not a valid Fortran session, then the call is erroneous.

When using MPI\_Session\_c2f(), the opposite conversion is applied. If **c\_session** is MPI\_SESSION\_NULL, or if **c\_session** is not a valid C session, then the call is erroneous.

## NOTES

These functions are only available in C; they are not available in any of the Fortran MPI interfaces.

## COPYRIGHT

2003-2026, The Open MPI Community
