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

Ben Discoe ben at v...
Mon Jan 14 13:45:03 EST 2002

> -----Original Message-----
> From: Frank Warmerdam [mailto:warmerdam at p...]
> > 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
> recently.
> 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.

I tried that (actually, i tried adding "-DSHPAPI_CALL=CPL_DLL" to EXTRAFLAGS
and including "cpl_port.h" in the modules, which should be equivalent.

Unfortunatly this didn't work. Apparently there is also another macro like


which is unhappy. I get compile errors on the lines with SHPAPI_CALL1:

shapefil.h(240) : error C2059: syntax error : 'type'
shapefil.h(249) : error C2059: syntax error : 'type'

I need to call both GDAL and shapelib.
I suppose there are 3 options here:
1. Try to build shapelib to a separate library, and link it in redundantly
with the copy in GDAL (praying there are no conflicts).
2. Try to modify the export status of shapelib in GDAL (as above, perhaps
there is some way to fix it)
3. Don't use shapelib, but do everything through OGR. I would be very
unhappy since using shapelib is so much simpler, clear and direct.



More information about the Gdal-dev mailing list