Skip to content

Generate C++17-compatible bindings - #3

Merged
alan-george-lk merged 7 commits into
livekit/devfrom
livekit/uniffi-0.31-cpp17
Sep 22, 2026
Merged

alan-george-lk merged 7 commits into
livekit/devfrom
livekit/uniffi-0.31-cpp17

Conversation

@alan-george-lk

@alan-george-lk alan-george-lk commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Downgrades C++20 support to C++17 (forwards compatible with C++20).

Regressions to be aware of:

  • Main one: .designated_initializer_lists = -- just moved to positional arguments
  • std::map::contains -- reverted to classic map.find() iterator approach
  • std::endian -- replaced with tiny helper function instead

@alan-george-lk
alan-george-lk added this pull request to stack #4 September 15, 2026 03:44
@alan-george-lk
alan-george-lk force-pushed the livekit/uniffi-0.31-cpp17 branch from 1b6a87a to 69dd556 Compare September 15, 2026 04:01
@alan-george-lk
alan-george-lk force-pushed the livekit/uniffi-0.31-cpp17 branch from f18ea96 to 0ed332d Compare September 15, 2026 15:35
}
private:
// Avoid platform-specific endian APIs while retaining C++17 compatibility.
static bool native_byte_order_is_little_endian() {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the biggest loss of the downgrade, not having native std::endian support is unfortunate. But this is a very small impl to get equivalency

@xianshijing-lk xianshijing-lk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit

// Avoid platform-specific endian APIs while retaining C++17 compatibility.
static bool native_byte_order_is_little_endian() {
const uint16_t value = 1;
return *reinterpret_cast<const unsigned char *>(&value) == 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, wonder if it is slightly more clear to do

static bool native_byte_order_is_little_endian() {
    const std::uint16_t value = 1;
    const auto* bytes = reinterpret_cast<const unsigned char*>(&value);
    return bytes[0] == 1;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@alan-george-lk
alan-george-lk force-pushed the livekit/uniffi-0.31-cpp17 branch from 0ed332d to 433eae1 Compare September 16, 2026 15:23
@alan-george-lk
alan-george-lk force-pushed the livekit/uniffi-0.31-cpp17 branch 2 times, most recently from 2abac60 to 7d04286 Compare September 22, 2026 18:43
@alan-george-lk
alan-george-lk removed this pull request from stack #4 September 22, 2026 19:04
@alan-george-lk
alan-george-lk changed the base branch from livekit/uniffi-0.31 to livekit/dev September 22, 2026 19:14
@alan-george-lk
alan-george-lk force-pushed the livekit/uniffi-0.31-cpp17 branch from 7d04286 to 8509eb6 Compare September 22, 2026 19:25
@alan-george-lk
alan-george-lk merged commit e558880 into livekit/dev Sep 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants