[postgis-users] Building PostGis with VC++

Frank Warmerdam warmerdam at pobox.com
Tue Aug 28 20:24:50 PDT 2007


Charlie Savage wrote:
> Third - and the big issue - the interface with proj4 needs to be fixed. 
>  On windows, its a no-no to mess with other dll's memory.  Postgis 
> accesses two global variables exposed by proj4.  This works ok if you 
> statically link to the proj4 library but not if you try to use the 
> proj4.dll.
...
> However, the one I couldn't solve was pj_errno.  In one place the 
> postgis code doesn't try to initialize it.  Of course proj4 does, so to 
> proj4 its zero, to postgis is a random number.  Thus postgis thinks that 
> proj4 *always* fails when calling transform.  In a second place, postgis 
> does try to initialize pj_errno which causes a segmentation fault.
> 
> The solution is to expose a function pj_get_errno() or some such in 
> proj4.  There actually is such a beast but it returns a pointer to the 
> errno, not the errno, so it doesn't work as is.  Can we just change this 
> method to return the errno instead?  Will this break existing clients? 
> If so, can we addd a new function to the api?

Charlie,

I'm not clear why it is bad to mess with another DLL's memory.  I thought it
was just dangerous to try and free memory allocated by another DLL (as they
may have distinct heaps).  If that is the case, it should be fine to use
pj_get_errno_ref() to get a pointer to the pj_errno in the PROJ DLL and
work by reference through that pointer.

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    | President OSGeo, http://osgeo.org




More information about the postgis-users mailing list