[Gdal-dev] environment variable problem in Visual Studio .NET 2003

Frank Warmerdam warmerdam at pobox.com
Fri Feb 27 10:36:13 EST 2004


David Lugan wrote:
> Hello GDAL-dev,
> 
> The setenv and putenv have a bug in Visual Studio .NET 2003.  Anyone 
> else have problems with this?
> 
> 
> My program calls _putenv("PROJ_LIB=C:\NAD"); so GDAL can use PROJ.DLL to 
> warp properly
> 
> When I work in Visual Studio .NET (2002) my program works great
> 
> After installing Visual Studio .NET 2003 Pro my program only warps 
> correctly sometimes
> 
> 
> 
> MY SOLUTION THAT WORKS:
> 
> Remove ALL putenv and getenv calls from the GDAL ( gdal-1.2.0a5 ) and 
> PROJ4 ( proj-4.4.7 ) source code.

David,

I am not aware of anywhere in GDAL or PROJ.4 that calls putenv() in
the libraries.  Can you point me to such?  I generally avoid putenv(),
partly because of it's inconsistent affect in various kinds of DLL build
situations.

There is a mechanism for application code to call pj_set_finder() to
install a custom program to "find" PROJ.4 support files.  This is generally
the way applications are expected to override PROJ.4's search behaviour rather
than resetting environment variables.

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 Gdal-dev mailing list