[Proj] PROJ 4.8.0, projects.h and projPJ struct

Frank Warmerdam warmerdam at pobox.com
Thu Apr 12 00:32:35 EST 2012

2012/4/11 José Luis García Pallero <jgpallero at gmail.com>:
> This function sounds good, but I have a couple of objections:
> 1. First of all, the portability of old code. The programs that until
> now include projects.h instead proj_api.h should be corrected. I
> propose to rename projects.h to projects_internal.h (for example) and
> create a new projects.h that contains only #include<proj_api.h> Then,
> it can be maintained in programs the #include<projects.h> and it runs
> always: prior to 4.8.0 and 4.8.0 or higher. Previously on this same
> topic I explained that is impossible to check automatically the
> version of PROJ via PJ_VERSION and select the correct header to
> include because if projects.h is included after proj_api.h some errors
> of conflicting types appears. Creating new projects.h could avoid this
> gotcha.


On linux configure can check for projects.h and probe for versions.

On windows you are generally having to handle proj yourself so what
is the big issue about different versions?

I guess I just don't feel this as a serious issue.

> 2. What about the old code that uses explicitly some fields of projPJ
> structs? Why in 4.8.0 projPJ fields are not public? For old code that
> uses explicitly fields of projPJ the solution of the point 1 is not
> valid. Another solution could be to define explicitly the PJ struct in
> proj_api.h. Whith this solution plus the new projects.h I think that
> almost all old code should have not problems with new 4.8.0 version

A large part of the reason for making projects.h private was to break
the dependence of application on the particulars of the layout of the
projPJ structure!  So, if you really need it, just include projects.h and
manually copy that from the source distribution.  But if you want to
follow the public API contract then stick to proj_api.h.

I don't mean to be peevish, but to me this seems to be an issue from
half a decade ago.  I've certainly been advising all to migrate to proj_api.h
for a long time.

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 Software Developer

More information about the Proj mailing list