[Gdal-dev] SWIG architecture

Ari Jolma ari.jolma at tkk.fi
Fri Jun 30 05:45:34 EDT 2006


I guess Hobu and Frank will have convincing arguments, I joined when the
design decisions were already made. The answer is probably in the web
pages: http://www.gdal.org/ogr/ "The C API is primarily intended to
provide a less fragile API since slight changes in the C++ API (such as
const correctness changes) can cause changes in method and class
signatures that prevent use of new DLLs with older clients. The C API is
also generally easy to call from other languages which allow call out to
DLLs functions, such as Visual Basic, or Delphi."

So it is both a development issue and an use issue.

I myself am writing yet another API with Perl on top of the Swig
modules: http://map.hut.fi/gdal-perl/Geo-GDAL.html

I see it also as a chance to write a new, clean, Perlish OO API. It will
be different from other language APIs, but that's inevitable I guess.

Are there any specific methods that you are missing? For example I just
added SetCoordinateDimension method to OGRGeometryShadow.

Ari

Collins, Benjamin kirjoitti:
> To the SWIG folks,
> 
> We were interested in using more OGR features to handle vector formats
> from the SWIG'ed Java wrappers.  However, the currently exposed
> interfaces do not include the necessary functions to get information
> about polygons, etc; especially not in the natural way that such
> information is available in the C++ API.
> I thought I would see that would result from a more hands-off approach
> to the SWIG *.i files.  I created a new ogr.i file with the
> ogrsf_frmts.h file '%include'd along with some of the other main files.
> (Later I had to modify this a little, but not in any important way.)  I
> SWIG'ed this and got a full featured, more object oriented Java
> interface than before.  I am able to essentially use the C++ API with a
> straigt "transliteration."  Some language-specific typemaps could still
> help, but this is not the essence of the experiment.
> 
> So my question is this:  why does the SWIG wrapper wrap the C-stlye
> API.  Why not just go for the C++, get all the OO for free (esp w/
> OGRGeometry)?
> Also, why the use of *Shadow, etc?
> 
> I fully realize that there may be some caveat of SWIG keeping us from
> this approach.
> 
> Thanks,
> --
> Ben Collins
> 
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev


-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma



More information about the Gdal-dev mailing list