Opened 9 years ago
Closed 5 years ago
#6268 closed task (wontfix)
GDALRegister driver setup questions
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
After r32110 for ogrsf_fmrts and r32190 with the raster frmts/*, I have a couple questions. Not all drivers are setup the same way and it's not immediately obvious why:
- Some check GDALGetDriverByName(), others do not
- Some check the version, others do not. e.g. GDAL_CHECK_VERSION("OGR/DODS driver")
- Some use a generic driver and set parameters. e.g. GDALDriver *poDriver = new GDALDriver(); There is a wide range of what is set on this. e.g. how many of the pfn functions are set
- Some just set a new instance of themselves. e.g. OGRSFDriver* poDriver = new OGRXPlaneDriver
- Some have an extern "C" declaration for the register function in the cpp file, some wrap the function in it, some do not have it. Yet all OGR drivers are inside of CPL_C_START in ogrsf_frmts.h. The local externs are therefore redundant.
- Raster drivers have gdal_frmts.h, but mostly use a local definition. Why not remove all local definitions and just use that header?
Sources:
I think we should:
- Remove all local declarations from cpp and just have them in two headers
- Remove all voids from the declarations
- Remove all wrapping of the actual functions definitions in cpp files within CPL_C_START
- Sort the driver list in the headers or add a comment to explain why they are in a particular order. Are they in the register order or random order?
Change History (2)
comment:1 by , 9 years ago
comment:2 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
Note:
See TracTickets
for help on using tickets.
Oh really? All drivers should check they aren't really registered
Yes, GDAL_CHECK_VERSION is useful for drivers that have dependencies to external libraries and could be compiled as plugins. This avoid linking an old plugin to a newer GDAL
Yeah, part of the OGR drivers that predate RFC 46 haven't been converted to GDAL drivers.
The local externes are generally left over of the initial stage of development where you compile the driver as a plugin before integrating it in the makefiles. Could be safely removed.
Isn't it the same question as above ?
+1
XXX foo(void) is the canonical way for a C compatible header, otherwise you'll get a warning
+1
Basically yes I believe they are in the same order in the .h as in the GDALAllRegister() function. No opinion if that must be reordered or not in the .h