Skip to content

[FEA]Refactor plugin ABI to use pure C types instead of void* for C++ objects #1018

@cdinea

Description

@cdinea

Description:

The cuCIM plugin interface currently uses opaque void* pointers to pass C++ objects (e.g., std::unique_ptr<std::vector<>>) across plugin boundaries. While this maintains a C-compatible struct definition, the underlying C++ objects still require the same C++ ABI and STL implementation on both sides of the boundary.

Problem:

Passing C++ objects as void* does not fully protect against ABI incompatibilities. If plugins are compiled with different compiler versions or STL implementations, the C++ object representation may differ, leading to potential runtime issues — even though the interface appears C-compatible.

Proposed improvement:

Refactor cross-plugin data structures to use pure C types (e.g., plain C arrays, cuCIM-defined structs) instead of hiding C++ types behind void*. This would provide true ABI stability and enable:
-compatibility across different compiler versions
-support for third-party plugins built with different toolchains
-potential for bindings to other languages (C, Python FFI, etc.)

Trade-offs:

-larger architectural change
-less convenient than direct C++ object passing
-current approach works reliably within cuCIM's controlled build environment (same GCC version, same STL)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions