[gdal-dev] Mixing gdal and shapelib?

Stephen Woodbridge woodbri at swoodbridge.com
Thu Sep 2 11:27:51 EDT 2010


On 9/2/2010 12:41 AM, Chaitanya kumar CH wrote:
> Before I read through the valgrind and gdb reports throughly, I want to
> suggest that you can compile gdal without ogr support.


Hi Chaitanya,

Not exactly the test you asked for because I can not easily install gdal 
without ogr on this server, but ...

I commented out the gdal calls and relinked with just the shapelib calls 
and the program runs fine linked without -lgdal

If I link with -lshp -lgdal it segv's.
If I link with -lgdal -lshp it works fine also.

because the later lib overides entry points of the prior libs.

Also looking at the ogr source:

woodbri at mappy:/u/software/gdal-1.7.2$ ls ogr/ogrsf_frmts/shape/ 
         dbfopen.c           makefile.vc             ogrshapelayer.cpp 
shptree.c
drv_shapefile.html  ogrshapedatasource.cpp  shape2ogr.cpp      shp_vsi.c
GNUmakefile         ogrshapedriver.cpp      shapefil.h
LICENSE.LGPL        ogrshape.h              shpopen.c

this shapefil.h is significantly different from the system shapefil.h 
and this embedded shapelib has not been moved to a different namespace 
so from this I have to conclude that you can not link shapelib with 
gdal/ogr libraries, which is too bad. I guess I'll go google the ogr 
tutorial and try to port this application to ogr tonight.

-Steve


More information about the gdal-dev mailing list