[gdal-dev] GDALDestroyDriverManager() and static driver pointers

Paul Selormey paul at t...
Wed Sep 4 04:44:03 EDT 2002

Hello Frank,
Thanks so much for the fix and the update. I also wished the static global
driver manager is actually managed by the user.

static GDALDriverManager *poDM = NULL;

Something like

GDALDriverManger gdalDriverMager;

GDALStartup(&gdalDriverMager, ...);

.....use it

GDALShutdown(&gdalDriverMager, ...);

However, after looking a bit at the sources, it seems this will affect the
framework. I could then have the GDALDriverManager as member of a class
in an application :-)

I have many wishes, but you know they are not horses :-) I also wished the
various drivers were implemented as share library (dll for Windows). That
I could simply take GeoTiff, if that is all that I want in an application.
In fact, if
there is no need to use GDAL to access a GeoTiff file, I could also use the
library directly.

Again, thanks so much.

Best regards,

----- Original Message -----
From: "Frank Warmerdam" <warmerdam at p...>
To: "gdal-dev" <gdal-dev at yahoogroups.com>
Sent: Wednesday, September 04, 2002 4:04 PM
Subject: [gdal-dev] GDALDestroyDriverManager() and static driver pointers

> Folks,
> I have implemented GDALDestroyDriverManager() in response to the request
> for a way to
> cleanup loaded drivers. However, to make it work smoothly, such that
> drivers can be reloaded
> properly with a GDALAllRegister() call after destroying the driver
> manager, it is important that
> we no longer maintain static driver pointers within out driver
> implementations.
> In the past each driver maintained a static pointer to its GDALDriver
> instance. The problem
> with this is that this doesn't get "NULLed" when the driver is
> destroyed. So, to fix do the
> following steps to any drivers not in CVS (I have fixed all these):
> o Remove the static pointer.
> o Remove any initialization of the poDriver pointer in the GDALDataset.
> This will be taken
> care of by GDALOpen().
> o Change your register function to check if the driver is already
> loaded by calling
> GDALGetDriverByName().
> Best regards,
> --
> ---------------------------------------+----------------------------------
> I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at p...
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush | Geospatial Programmer for Rent
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

More information about the Gdal-dev mailing list