Accessing Linux system mmap/munmap functions

I’m attempting to use the mmap & munmap system functions directly from a Fortran 95 application. However, the linker doesn’t recognize them. I suspect that there’s a USE or include file I should be referencing, but I can’t find any documentation identifying which libraries or include files I should be referencing.

Any guidance?

Hi tsalem,

I’m guessing the compiler is adding an underscore since it doesn’t know that mmap and munmap are C functions?

In this case, you should create an interface block for these routines and use F2003 ISO_C_BINDING to define the routine (i.e. BIND(C) ) and the arguments as C types.

Alternatively, you can write in C and interface routine that maps mmap_ and munmap_ to the C routines. Chapter 12 of the PGI User’s gives example on how to do this.

Hope this helps,
Mat