[gdal-dev] How to re-register a driver

Allen Kempe allenck at windstream.net
Fri Mar 8 17:20:55 PST 2013

In my application, I would like to be able to programatically specify 
which driver to use when opening a GDALDataset when more than one driver 
can process the file. To do this, I have deregistered the drivers that I 
don't want to use. The GetGDALDriverManager-::DeregisterDriver() 
function does the trick.

The problem I have is being able to reregister the drivers that I 
deregistered above. First of all, in order to register a driver, you 
need a handle to it. It would seem that GetDriverByName should do the 
trick but it returns NULL if the driver was previously deregistered. 
Looking at the GDALDriverrManager code, it is easy to see why this is as 
GDALDriver manager only searches the currently enabled drivers to get 
its handle.

I then thought that calling GDALDriverManager::AutoloadDrivers() would 
reinitialise the driver list but it does not return the driver that has 
been deregistered.  It would seem that GDALRegisterDriver would work but 
it requires a handle to the driver which as I stated above, cannot be 
obtained once a driver has been deregistered.

So, how does one get a handle to a deregistered driver or alternatively, 
how can GDALDriverManager::AutoloadDrivers be made to reconstruct the 
driver list with all the currently configured drivers?

It seems that GDALDriverManager::RegisterDriver is a useless function 
since there is no way to get a handle to a previously deregistered driver.

    Allen Kempe

298 W. Audubon Drive
Shepherdsville, KY 40165
+1 502 543-3438
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130308/c39ae795/attachment.html>

More information about the gdal-dev mailing list