A colleague showed me the Proj-4 library for coordinate transformation. It looked promising, so our systems manager compiled and installed it on our linux box. An example C code shows that indeed a basic transformation is performed allright with the new library.
My current Fortran-90 project, compiled with PGF90, uses a lot of coordinate transformations, so far coded ad hoc my me. I would like to use the routines and functions in libproj.a from within my Fortran code instead to gain accuracy, speed and support for more types of coordinates. I wrote a Module that should handle the interfacing with 2 of the C routines in libproj.a as follows:
PUBLIC :: pj_init_plus, pj_transform
! Interfacing with C-routines from file “libproj.a”
function pj_init_plus(name) bind(C,name=’_pj_init_plus’)
end function pj_init_plus
function pj_transform(src, dst, point_count, point_offset, &
x, y, z) bind(C,name=‘pj_transform’)
type(c_ptr) src, dst
integer(C_LONG), value :: point_count
integer(C_INT), value :: point_offset
real(C_DOUBLE) x, y, z
end function pj_transform
END MODULE LibMyP
On my Windows box at home this compiles using g95. My sample Fortran main program however does not link using g95. Today at the office, this same code of Module libmyp is not accepted by PGF90. Module ISO_C_BINDING is not found. Apparently the suggestion to use ISO_C_BINDING is not generic.
–> Can you please give a hint of how to use libproj.a in combination with pgf90?