Cross‑Platform C++ Message SDK Architecture and Development Practices
Over three years the team built a lightweight, C++‑based cross‑platform messaging SDK for a large e‑commerce group, choosing C++ for performance, creating a custom 43‑KB/116‑KB foundation library, organizing five modular layers, employing a pure‑asynchronous thread model, and automating development with the Eyas scaffolding, language‑binding generation and unified GN builds to simplify multi‑OS deployment and reduce engineering effort.
This article shares the three‑year evolution of a C++‑based cross‑platform messaging SDK used by a large e‑commerce group. It explains why a cross‑platform approach is needed, the choice of C++ as the implementation language, and the design of a lightweight, reusable foundation library.
Why cross‑platform? Unified business requirements across many apps (iOS, Android, macOS, Windows) make separate native implementations costly and inconsistent. A single SDK reduces development, testing, and maintenance effort.
Language selection focuses on C++ for its native performance, rich ecosystem, and ability to call system APIs on all target platforms.
Base library choice involved evaluating existing C++ libraries and deciding to build a custom lightweight library (LITE) that meets size constraints (≈43 KB on Android, 116 KB on iOS) while providing essential functionality.
Architecture overview describes five layers: Service (language wrappers for Java/Obj‑C/C++), Business (modular message, profile, group logic), Data (local and network storage with adapters), Channel (SYNC, WXNet, DB), and Base Services (the C++ foundation). The design emphasizes minimal, extensible components, open points for customization, and independent modules to keep package size optimal.
Thread model adopts a pure‑asynchronous approach: the access layer accepts calls from any thread, business modules run on dedicated threads, and I/O/network operations are off‑loaded to model threads, achieving lock‑free per‑business execution and non‑blocking I/O.
C++ engineering scaffolding introduces the Eyas project, which provides a standardized SDK development workflow: project creation from templates, automatic generation of language‑binding code (using a customized Djinni tool), unified GN build configuration, and dependency management across platforms.
The workflow includes four steps: creating a project, generating binding code, configuring compilation and dependencies, and building the SDK. Tools automate repetitive tasks such as wrapper generation and ensure consistent build settings for Android, iOS, macOS, and Windows.
Finally, the article introduces the team behind the SDK, their responsibilities for large‑scale messaging services, and the goal of lowering cross‑platform development barriers for new engineers.
DaTaobao Tech
Official account of DaTaobao Technology
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.