[gdal-dev] VSI handlers as plugin (shared library)
Even Rouault
even.rouault at spatialys.com
Mon Nov 2 12:47:40 PST 2015
Le lundi 02 novembre 2015 21:44:20, Ivan Lucena a écrit :
> Hi Even,
>
> It doesn't seems like we are talking about the same think.
I think we do talk about the same thing :-)
>
> A VSI handler is is not an GDAL/OGR driver, so I can't see how that would
> work.
Well, you can just pretend that your shared object is a module that contains a
GDAL driver, but you don't need to put a GDAL driver in it. AutoLoadDrivers()
doesn't check that a driver will be registered. It will just call the entry
point.
So just try what I suggested: add a extern "C" GDALRegisterME() that calls
your VSI handler installation, and you'll be done.
I've used this technique recently for the port/cpl_vsil_crypt.cpp module to
make it work against OSGeo4W unmodified binaries.
>
> A VSI Handler is registered at that code
> [https://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_vsil.cpp#L1153].
>
> I wrote my VSI code on /port and add a installation function to cpl_vsi.h
> and everything is working just fine when HAVE_OCI is detect by the
> makefiles.
>
> But you gave me an idea, I could move my code from /port/cpl_vsil_XXX.cpp
> to /frmts/georaster/cpl_vsil_XXX.cpp and register it from there. If
> possible.
>
> Then I would not need a VSI plugin, since the georaster driver plugin is
> the only user of my VSI handler.
>
> Does it make sense?
>
> Regards,
> Ivan
>
>
> ________________________________________
> From: Even Rouault <even.rouault at spatialys.com>
> Sent: Monday, November 2, 2015 3:09 PM
> To: gdal-dev at lists.osgeo.org
> Cc: Ivan Lucena
> Subject: Re: [gdal-dev] VSI handlers as plugin (shared library)
>
> Le lundi 02 novembre 2015 20:58:59, Ivan Lucena a écrit :
> > Hi there,
> >
> >
> > What if we could build and distribute VSI handler as plugins?
> >
> >
> > I developed a VSI handler that depends on other software, so I would
> > rather not build the GDAL main library with that dependency and let the
> > user decided if they want to use the plugin or not.
> >
> >
> > We would need to have a code on cpl_vsil.cpp similar to AutoLoadDrivers()
> > from gdaldrivermanager.cpp to load vsi_XXX.{so,dll} dynamically.
> >
> >
> > Would that be worth the effort? Any other cases where that could be
> > useful?
>
> Ivan,
>
> You don't need to change anything in GDAL, assuming that you call
> GDALRegisterAll() at some point. Just add a C function GDALRegisterMe() in
> your shared module, call the shared object gdal_XXXXXXX.so/dll and you're
> done.
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list