私は自分のソフトウェアで geos ライブラリをジオメトリ エンジンとして使用しています。現在、その capi を使用しています (推奨される API であるため)。
問題は、構造体 GEOSGeometry をシリアライズおよびデシリアライズしたいということです。ライブラリ自体は c++ であり、capi はそのラッパーです。したがって、構造体定義は、言うまでもなく利用できません。私のオプションは何ですか?
これはカピが言及しているものです
/* When we're included by geos_c.cpp, those are #defined to the original
* JTS definitions via preprocessor. We don't touch them to allow the
* compiler to cross-check the declarations. However, for all "normal"
* C-API users, we need to define them as "opaque" struct pointers, as
* those clients don't have access to the original C++ headers, by design.
*/
#ifndef GEOSGeometry
typedef struct GEOSGeom_t GEOSGeometry;
で、こんな風に巻かれています
// Some extra magic to make type declarations in geos_c.h work -
// for cross-checking of types in header.
#define GEOSGeometry geos::geom::Geometry
どんな助けでも大歓迎です。