0.4.32 exports many private symbols from ctx
gegl 0.4.32 adds a copy of @ok's "ctx" library, which results in lots of symbols from ctx being exported from gegl.
This seems risky: as far as I can see, ctx is a single-file library with an unstable API/ABI designed to be bundled/vendored. If anything other than gegl in an executable's dependency stack also vendors a copy of ctx, one of them will interpose over the other's symbols and cause crashes, because ELF symbol resolution happens in a flat global namespace.
One common way to deal with this is to define a macro that is used to decorate all public symbols in header files, something like this:
#ifdef G_OS_WIN32
# ifdef _GEGL_COMPILATION
# define _GEGL_PUBLIC __declspec(dllexport)
# else
# define _GEGL_PUBLIC __declspec(dllimport)
#elif defined(__GNUC__)
# define _GEGL_PUBLIC __attribute__((visibility("default")))
#endif
/* When declaring each public symbol */
_GEGL_PUBLIC void gegl_node_set_time (GeglNode *node, double time);
and then build the library with -D_GEGL_COMPILATION
and, if using gcc or clang, -fvisibility=hidden
. This results in all symbols being private to the library (hidden), except for symbols that are explicitly exported with _GEGL_PUBLIC
.
Alternatively, it can be done the opposite way round, by exporting symbols by default, but decorating hidden symbols with G_GNUC_INTERNAL
(or a reimplementation of that macro, for non-GLib code - see its API documentation for details).