[gdal-dev] SHP support in GDAL vs. GDAL-OGR

Frank Warmerdam warmerdam at p...
Mon Jan 14 09:35:09 EST 2002

Ben Discoe wrote:

> I notice that there is SHP file support in two place in GDAL:
> gdal/fmts/shapelib
> gdal/ogr/ogrsf_frmts/shape
> As far as i can tell, there are some differences, but there is substantial
> overlap as well, e.g. there are identical copies of 'shpopen.cpp', etc.


The code in gdal/frmts/shapelib is the "master". Is it periodically
copied to gdal/ogr/ogrsf_frmts/shape as needed. This mess was due to
the convenience for me at one time of having the Shapelib under CVS,
and putting within the GDAL tree seemed handy. This was before there
was an OGR!

> Some questions:
> 1. Why aren't the duplucate modules conflicting? I've studied the VC
> makefiles, but it's not very clear... perhaps the first (fmts/shapelib)
> isn't getting built?

The code in gdal/frmts/shapelib isn't actually compiled and linked into

> 2. I used to be able to call shapelib directly (function SHPOpen() etc.) and
> link with GDAL to get the functions. Now with 1.1.6, the linker says the
> symbols (like SHPOpen) are undefined. As far as i can tell, SHPAPI_CALL was
> "" in both 1.1.5 and 1.1.6, so i don't know why this would have changed.
> Why did it stop working, what do i need to do to call the shapelib inside
> GDAL? Do i need to set SHPAPI_CALL=CPL_DLL?

I am not sure why this used to work for you, I don't remember changing it

You are welcome to add -DSHPAPI_CALL=__declspec(dllexport) to the
EXTRAFLAGS in gdal/ogr/ogrsf_frmts/shape/makefile.vc. If this works we
can add it to makefile.vc in CVS.

Best regards,

I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
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