Description
Motivation
Provide some memory mapped file features to Fortran. These features are indeed accessible througt the C interoperability, but the idea here is to encapsulate them to get an easy to use interface, with additional runtime checks. Two meain usages:
- allocating arrays that are potentially bigger the RAM+swap size, and are which are backed in a temporary file (anonymous mapping)
- opening existing files or creating new files, and mapping them to arrays
Prior Art
Searching "memory mapped files Fortran" in Google returns results that all use the C interoperability of C/posix features, or Windows specific routines with the Intel compiler. A stdlib implementation should have the OS dependent code under a unique interface.
Additional Information
This was originally discussed on the Fortran Discourse, where the inclusion in stdlib has been suggested.
I have prepared a small demonstration code to show what it could look like (C/posix stuff only): https://github.com/PierUgit/fmmap/tree/main