# PetscMPIFortranDatatypeToC
Converts a `MPI_Fint` that contains a Fortran `MPI_Datatype` to its C `MPI_Datatype` equivalent 
## Synopsis
```
PetscErrorCode PetscMPIFortranDatatypeToC(MPI_Fint unit, MPI_Datatype *dtype)
```
Not Collective


## Input Parameter

- ***unit -*** The Fortran `MPI_Datatype`



## Output Parameter

- ***dtype -*** the corresponding C `MPI_Datatype`





## Developer Note
The MPI documentation in multiple places says that one can never us
Fortran `MPI_Datatype`s in C (or vice-versa) but this is problematic since users could never
call C routines from Fortran that have `MPI_Datatype` arguments. Jed states that the Fortran
`MPI_Datatype`s will always be available in C if the MPI was built to support Fortran. This function
relies on this.

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/f90-src/f90_cwrap.c.html#PetscMPIFortranDatatypeToC">src/sys/f90-src/f90_cwrap.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/f90-src/f90_cwrap.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
