[Proj] Building for and calling from g95-MinGW

Frank Warmerdam warmerdam at pobox.com
Tue Feb 17 17:20:18 EST 2009


Arjan van Dijk wrote:
> Hi!
> 
> I compile and run my program on linux and Windows boxes.
> Under Fortran-90 that is...
> Now I would like to use Proj. I have 2 questions about this:
> 
> Question 1:
> How do I generate/download an archive file (e.g. libproj.a)
> that can be used from g95 under MinGW by just adding -lproj to the
> compile command of my program?
> The Windows binaries contain an executable and a dll, not a .a-file.
> Can I just use the linux .a-file under MinGW? I guess not.
> I downloaded the sources and called "./configure".
> This went okay. Then I tried "make", but the whole thing
> crashed... (see below this message for the rude curses it uttered)!

Arjan,

I do not believe it is practical to use the proj.a file from linux
with mingw on win32.  If you have a PROJ.4 win32 .lib file, you can
just rename this to .a to use with MinGW's gcc and linker even if
the .lib file was generated with MSVC (in my experience).

> Question 2:
> Are there any Fortran examples for using Proj?

I am not aware of any.  If you are successful, I'd encourage you to add
some notes in the PROJ.4 trac wiki.

Gerald I. Evenden wrote:
 > In simple cases FORTRAN and C[++] are not too difficult to link but there is
 > one issue I can't find a solution in Google searching:
 >
 > How do you handle C structures in FORTRAN?  Do not include "common."

The XY/UV structures passed to pj_fwd() and pj_inv() can just be
passed as a REAL*8 array of size two since the structure is effectively
just an array of two doubles.

The PJ structure pointer could likely just be passed around as a
32bit integer since it is effectively opaque to application code.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Proj mailing list