wiki:RFC6

Version 22 (modified by robe, 7 years ago) ( diff )

--

GEOS RFC 6: Require explicit configure to use the C++ API

RFC 6: Discourage use of C++ API by requiring a configure switch to install the c++ headers and SDK
Author: Regina Obe
Contact:lr@…
Status: Not Passed

Past discussions Trac ticket to deprecate another request to deprecate and osm2pgsql mess more examples about how apps linking directly to GEOS C++ causing problems for other applications Pointing out removing ability to use GEOS C++ reduces users freedoms

This document proposes to change the ./configure and CMake to by default only allow use of the C-API. The C++ API headers and library will only be installed if explicitly asked for as detailed in https://lists.osgeo.org/pipermail/geos-devel/2017-October/008054.html

Any developers who want to use the C++ API will have to build with

#autoconf users
   ./configure --with-cplusplus-sdk-install

#cmake users
   cmake -DINSTALL_CPLUSPLUS_SDK

If cplusplus sdk install is not expressly requested only the C headers will be included and the C++ headers will not be installed. In addition, when tthe C++ headers are used by any project

If users choose to build with the cplusplus-sdk, a warning will be shown before start of compile stating:

The GEOS project does not guarantee ABI stability of the C++ API during minor updates. 
This means your code may need recompilation or changes to upgrade to next minor version of GEOS.  
If you want ABI stability from minor version to minor version, you should use the C-API instead.

In addition the GEOS C++API Headers Geometry.h will by default include a warning as noted in https://git.osgeo.org/gogs/geos/geos/pulls/14 as proposed in https://lists.osgeo.org/pipermail/geos-devel/2017-October/008071.html

The GEOS C++ API is unstable, please use the C API instead
HINT: #include geos_c.h

Which will show during compile time if the following variable is not defined

WE_ACKNOWLEDGE_THAT_THE_GEOS_CPLUSPLUS_API_IS_UNSTABLE

This message will continue to be shown in every project that a user tries to compile using GEOS C++ API headers.

I propose doing this in GEOS 3.7.0.

The main purpose is to discourage the use of the C++ API because we do not have the manpower to guarantee ABI or API compatiblity from minor version to minor version and thus using it in an environment where the GEOS library is shared across many software is unsupported. We are also planning significant refactoring in GEOS 3.8 which will very likely break the C++ API.

Currently osm2pgsql (which is switching away from GEOS and using Osmium instead) (and before Osmium, which switched from using GEOS and now uses GDAL) and OSSIM are the only ones that used the GEOS C++ API and largely distributed in shared environment. We want to discourage future projects that plan to be used in a shared environment from using the GEOS C++ API and to stick with the GEOS C API.

So the purpose of the above is to affect the following change:

1) Package Distributions do not need compile with these flags, though they may choose to at their own risk to support C++ API users.

2) The end effect being, no C++ header, no C++ library to worry about -- just a single .so or .dll and a C header file

3) People building their own binaries or their own projects that utilize the C++ API will not be able to use GEOS from packages since GEOS packages will not have the C++ API bindings they need.

They will have to compile their own GEOS.

This means if they want their product to be shipped with other distributed software and share the same GEOS, they will need to use the C-API.

That way new projects will be clear about what compromise they are making using the C++ API.

Note: See TracWiki for help on using the wiki.