Files
logos-cpp-sdk/cpp-generator
Dario Gabriel LipicarandClaude Opus 5 51abc407df fix(cdylib): guard the conditional exports on MAJOR too, not MINOR alone
The three version guards this emitter writes tested
LOGOS_PROTOCOL_VERSION_MINOR and ignored LOGOS_PROTOCOL_VERSION_MAJOR. At
protocol 1.0.0 the MINOR resets to 0, so all three would have gone false
and the C++ backend would have dropped from ten module-impl exports to
seven — losing grant_host_services (0.3) and the teardown pair (0.5).

What makes this worth catching early is that it is NOT a link error and
NOT a dlopen failure. logos-plugin-qt's glue guards the matching CALLS the
same way, so the definitions and the calls disappear together: everything
builds, everything loads, and modules simply stop having teardown and stop
being grantable. There is no diagnostic anywhere. logos-rust-sdk would
meanwhile keep emitting all ten, because it compares the (major, minor)
tuple — so the two backends would silently disagree.

The arithmetic is emitted EXPANDED rather than behind a function-like
macro, because the generated sources are resolved by unifdef in the check
below, and unifdef evaluates nested integer arithmetic but silently
no-ops on what it cannot parse — which would be a green check over
unresolved text.

checks.<sys>.module-impl-abi gains the probe that would have caught it: it
already resolved the generated sources at the real MINOR and at MINOR=0,
and now also at one MAJOR up, where the full declared export set must
still be emitted. Nothing pins that to 1 in particular — it is "one past
whatever we are on", which is exactly where a MINOR-only guard breaks, and
it is the only probe here that does not resolve at the current major.

Proven to fail: reverting only the guard change turns it red naming all
three affected exports.

    FAIL: [A: --from-header, header-first] the export set is not complete
          at protocol 1.0.
      DECLARED but NOT emitted once the MAJOR advances:
          - logos_module_about_to_unload
          - logos_module_grant_host_services
          - logos_module_set_unload_done_callback

The MAJOR is read from the same logos-protocol output as the MINOR and the
export list, so no version literal enters this check.

logos-plugin-qt carries the same defect in its two glue guards; that is a
separate PR, and until both land the two sides still agree at every
version that exists today.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 17:33:24 -03:00
..