[Proj] Use of C++

Even Rouault even.rouault at spatialys.com
Wed May 23 13:21:19 EST 2018


Andrew,

> If C++ isn't used at the API, isn't this an implementation detail as long
> as it builds on systems you want to target?

Indeed, but that's already an important requirement with respect to the 
current situation.

As I mentionned, I think some of the C++ code might be useful as being used 
directly as API. What exactly remains to be determined. After some 
prototyping, I'll have a better vision.

> 
> That said, the issue I have with the GDAL API, which is mentioned as a
> model, 

I didn't mean GDAL as a model for the API. Just that some code of it might be 
reused as a starting point.

> is that it's complicated in that it's always unclear who owns what
> and what needs to be freed by the application, etc.  

That's another point, but I'd hope the GDAL API doc to be generally clear on 
ownership and what destroy functions should be called. If not, ticket or pull 
requests are welcome. And the API surface of GDAL is much larger than proj, so 
hard to compare.

> If a binary-compatible C++ interface
> is important, hiding the implementation behind a pointer is standard
> practice and works pretty well.

I wouldn't aim for a binary-compatible C++ ABI between major versions of the 
library where new functionality might be added. That's just impossible/too 
complicated to achieve in practice: even if you hide private members (which 
might be a good idea to be able to deal with bugs in minor versions), any new 
virtual method breaks the C++ ABI for example.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Proj mailing list