[Gdal-dev] Exception thrown in GDALOpen() function

N. Farah nfarah at hotmail.com
Mon Jul 28 16:45:09 EDT 2003


My call to GDALOpen() is now working after having the binaries in debug mode 
as my program is in debug mode. I'm opening a tif file and translating it to 
erdase imagine for testing purposes (i'm aware that a program already exist 
for that operation). I'm kind of exploring GDAL now.

My steps are simple:
- Drivers registration (here tiff and imagine),
- GDALOpen()..
- GDALGetDriverByName()
- GDALCreateCopy().

All the steps went fine except the last one. The .img file is created and 
seems to be ok.
The exception is risen in the cleaning phase. GDALOpenInfo object is being 
destructed and an exception is risen when trying to close the .img file.

After a bit of investigation, i found out that .img is opened (in the source 
code) using VSIFOpenL function (in the HFAOpen() method), then the file 
pointer is passed back to the GDALOpenInfo  object.

Once the destructed of GDALOpenInfo  is called, the file is being closed 
with VSIFClose. In the imagine case the closing would be done using 
VSIFCloseL and not VSIFClose. I guess that this is what causing the 
exception. It appears that GDALOpenInfo assume that the file is always 
opened using VSIFOpen.

Noureddine Farah

Help STOP SPAM with the new MSN 8 and get 2 months FREE*   

More information about the Gdal-dev mailing list