[Gdal-dev] DriverManager

Frank Warmerdam warmerdam at pobox.com
Fri Oct 15 11:11:44 EDT 2004


Matthew Hanson wrote:
> Hi,
> 
> When is the global DriverManager object created?  

Matt,

It is created by the first call to GetGDALDriverManager().  This usually
happens in the all register function.

 > I thought it would be
> created in the GDALAllRegister function.  What I wanted to do is make the
> AllRegister function happen in the background in my wrapper.  
> 
> - If the AllRegister function has not been called will GetGDALDriverManager
> return a 0?

No, it never returns NULL.

> - The declaration for GetGDALDriverManager does not occur in gdal.h (but
> DestroyDriverManager does), but instead is in gdal_priv.h.  Shouldn't it be
> in the C API header?

The driver manager class is a singleton, and so it's existance as a descrete
object is masked by the C API.  There is little point in exposing it.

> - There's one global instance of DriverManager which (sorta) holds/manages
> one instance of GDALDriver for each format type. Does calling
> DestroyDriverManager end up destroying all these instances and deregistering
> all the drivers?

Yes.

> - I'm trying to figure out the C wrapper works, there's the gdal.h with the
> declarations, but how is it linked to the native C++ object functions?

Linked?

The gdal.h declares all the C API functions.  The implementation of the
C functions is normally found in the source files right next to the
corresponding C++ method implementation.  The produced GDAL DLL exports
the C and C++ interface.

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