C++ — in 5 Minuten zum ersten Sample
C++17-Header-Wrapper über die libzerodds.so-C-API. OMG DDS-PSM-Cxx 1.0-kompatible Surface (dds::domain::DomainParticipant, dds::pub::DataWriter<T>, …). IDL→C++-Codegen via zerodds-idlc generate --lang c++ für typisierte Topics. ABI-stabil; ein binary läuft gegen jede patch-Version.
5-Minuten-Quickstart
libzerodds.so bauen, ein C++-File, ein g++-Call.
1 · libzerodds installieren
Hol dir die C-Runtime (libzerodds.{so,dylib,dll} + zerodds.h) auf dem Weg der für dich am wenigsten Reibung macht — entweder pre-built, via Paketmanager, oder aus Source.
Pre-built Pakete (1.0.0-rc.7)
Direkt-Download von GitHub Releases v1.0.0-rc.7:
# Ubuntu/Debian (amd64; arm64: _arm64.deb). zerodds-dev braucht zerodds-core und zerodds-cli
wget https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-core_1.0.0-rc.7_amd64.deb \
https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-cli_1.0.0-rc.7_amd64.deb \
https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-dev_1.0.0-rc.7_amd64.deb
sudo apt install ./zerodds-core_1.0.0-rc.7_amd64.deb ./zerodds-cli_1.0.0-rc.7_amd64.deb ./zerodds-dev_1.0.0-rc.7_amd64.deb
# Fedora/RHEL: die RPMs von rc.7 lassen sich nicht installieren (zerodds-core verlangt libzerodds.so()(64bit), das kein Paket bereitstellt); aus der Quelle bauen, siehe User Guide
# macOS, Windows: das .pkg und das MSI enthalten nur die Programme, keine Header und kein libzerodds; aus dem Source bauen (unten)
# Portable Tarballs (*.tar.xz) je Komponente und Target: siehe Release-Seite
Paketmanager
# Arch Linux — AUR
yay -S zerodds-bin # Binary-Variante (schneller)
yay -S zerodds # Source-Build über makepkg
# Docker (Kommandozeilenprogramme; die Bridges sind eigene Images)
docker pull fishermen21/zerodds-cli:v1.0.0-rc.7
Paketquellen: APT-Repo packages.zerodds.org/deb (apt install zerodds-dev, siehe User Guide) und Scoop-Bucket zero-objects/scoop-zerodds. Chocolatey gibt es nicht.
Aus Source (Entwicklung)
git clone https://github.com/zero-objects/zero-dds.git
cd zero-dds
cargo build --release -p zerodds-c-api
# erzeugt target/release/libzerodds.{so,dylib,dll} + crates/zerodds-c-api/include/zerodds.h
2 · Pub/Sub-Roundtrip (hello.cpp)
#include "zerodds/dds.hpp"
#include <chrono>
#include <iostream>
#include <thread>
int main() {
using namespace std::chrono_literals;
zerodds::Runtime rt(0);
zerodds::Writer w(rt, "Chatter", "RawBytes", /*reliable=*/true);
zerodds::Reader r(rt, "Chatter", "RawBytes", /*reliable=*/true);
w.wait_for_matched(1, 5000);
r.wait_for_matched(1, 5000);
std::vector<uint8_t> payload{'h','e','l','l','o'};
w.write(payload);
std::this_thread::sleep_for(200ms);
auto sample = r.take();
std::cout << "got: " << std::string(sample.begin(), sample.end()) << "\n";
return 0;
}
3 · Bauen + laufen
g++ -std=c++17 -O2 -Wall \
-I crates/zerodds-c-api/include \
-I crates/cpp/include \
-L target/release \
-o hello hello.cpp \
-lzerodds -lpthread -ldl -lm
LD_LIBRARY_PATH=target/release ./hello
# got: hello
Installation
Linking-Variante: dynamisch
Default. libzerodds.so wird zur Laufzeit geladen; ABI-stabil über patch-Versionen.
g++ ... -L target/release -lzerodds -lpthread -ldl -lm
Linking-Variante: statisch
Cargo erzeugt auch libzerodds.a (staticlib). Für single-binary-Deployment:
g++ ... target/release/libzerodds.a -lpthread -ldl -lm
Achtung: Linux braucht -Wl,--gc-sections und -Wl,--as-needed für minimale Binary-Größe.
System-Pakete (DEB/RPM)
Pre-built Pakete unter github.com/zero-objects/zero-dds/releases. Installation:
# Ubuntu/Debian
sudo apt install ./zerodds-core_1.0.0-rc.7_amd64.deb ./zerodds-cli_1.0.0-rc.7_amd64.deb ./zerodds-dev_1.0.0-rc.7_amd64.deb
# Fedora/RHEL: die RPMs von rc.7 lassen sich nicht installieren (zerodds-core verlangt libzerodds.so()(64bit), das kein Paket bereitstellt); aus der Quelle bauen, siehe User Guide
# Header + libs landen in /usr/include/zerodds + /usr/lib/
Typisierte Topics — zerodds-idlc generate --lang c++
Statt RawBytes kannst du IDL-definierte Strukturen direkt publizieren. zerodds-idlc generate --lang c++ schreibt einen Header mit dem Typ, seinem XCDR2-Codec und der Spezialisierung dds::topic::topic_type_support<T>, die zerodds/dds.hpp für jeden Topic-Typ verlangt. Der Codec ruft die C++-Wire-Runtime (runtime/cpp); den Build zeigt das Beispiel cpp-typed.
IDL definieren (temperature.idl)
module sensor_msgs {
module msg {
struct Temperature {
long celsius;
string sensor_id;
};
};
};
Codegen
zerodds-idlc generate --lang c++ --out gen/ temperature.idl
# schreibt gen/temperature.hpp
Nutzen
#include "gen/temperature.hpp"
#include "zerodds/dds.hpp"
int main() {
zerodds::Runtime rt(0);
zerodds::TypedWriter<sensor_msgs::msg::Temperature> w(rt, "Temp");
sensor_msgs::msg::Temperature t{23, "A7"};
w.write(t);
}
Vendor-Spec: DDS-PSM-Cxx 1.0 Spec-Coverage →
Tests & CI
cd crates/cpp/examples
./build_cpp_smoke.sh
# verifiziert: zerodds.h + zerodds/dds.hpp + Pub/Sub-Roundtrip
Im Repo: crates/cpp/tests/
C++ — first sample in 5 minutes
A C++17 header wrapper over the libzerodds.so C API. OMG DDS-PSM-Cxx 1.0-compatible surface (dds::domain::DomainParticipant, dds::pub::DataWriter<T>, …). IDL→C++ codegen via zerodds-idlc generate --lang c++ for typed topics. ABI-stable; one binary runs against any patch version.
5-minute quickstart
Build libzerodds.so, one C++ file, one g++ call.
1 · Install libzerodds
Get the C runtime (libzerodds.{so,dylib,dll} + zerodds.h) the way that's the least friction for you — either pre-built, via a package manager, or from source.
Pre-built packages (1.0.0-rc.7)
Direct download from GitHub Releases v1.0.0-rc.7:
# Ubuntu/Debian (amd64; arm64: _arm64.deb). zerodds-dev needs zerodds-core and zerodds-cli
wget https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-core_1.0.0-rc.7_amd64.deb \
https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-cli_1.0.0-rc.7_amd64.deb \
https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.7/zerodds-dev_1.0.0-rc.7_amd64.deb
sudo apt install ./zerodds-core_1.0.0-rc.7_amd64.deb ./zerodds-cli_1.0.0-rc.7_amd64.deb ./zerodds-dev_1.0.0-rc.7_amd64.deb
# Fedora/RHEL: the rc.7 RPMs cannot be installed (zerodds-core requires libzerodds.so()(64bit), which no package provides); build from source, see the User Guide
# macOS, Windows: the .pkg and the MSI carry only the programs, no headers and no libzerodds; build from source (below)
# Portable tarballs (*.tar.xz) per component and target: see the release page
Package managers
# Arch Linux — AUR
yay -S zerodds-bin # binary variant (faster)
yay -S zerodds # source build via makepkg
# Docker (command-line programs; the bridges are separate images)
docker pull fishermen21/zerodds-cli:v1.0.0-rc.7
Package sources: the APT repository packages.zerodds.org/deb (apt install zerodds-dev, see the user guide) and the Scoop bucket zero-objects/scoop-zerodds. There is no Chocolatey package.
From source (development)
git clone https://github.com/zero-objects/zero-dds.git
cd zero-dds
cargo build --release -p zerodds-c-api
# produces target/release/libzerodds.{so,dylib,dll} + crates/zerodds-c-api/include/zerodds.h
2 · Pub/sub roundtrip (hello.cpp)
#include "zerodds/dds.hpp"
#include <chrono>
#include <iostream>
#include <thread>
int main() {
using namespace std::chrono_literals;
zerodds::Runtime rt(0);
zerodds::Writer w(rt, "Chatter", "RawBytes", /*reliable=*/true);
zerodds::Reader r(rt, "Chatter", "RawBytes", /*reliable=*/true);
w.wait_for_matched(1, 5000);
r.wait_for_matched(1, 5000);
std::vector<uint8_t> payload{'h','e','l','l','o'};
w.write(payload);
std::this_thread::sleep_for(200ms);
auto sample = r.take();
std::cout << "got: " << std::string(sample.begin(), sample.end()) << "\n";
return 0;
}
3 · Build + run
g++ -std=c++17 -O2 -Wall \
-I crates/zerodds-c-api/include \
-I crates/cpp/include \
-L target/release \
-o hello hello.cpp \
-lzerodds -lpthread -ldl -lm
LD_LIBRARY_PATH=target/release ./hello
# got: hello
Installation
Linking variant: dynamic
The default. libzerodds.so is loaded at runtime; ABI-stable across patch versions.
g++ ... -L target/release -lzerodds -lpthread -ldl -lm
Linking variant: static
Cargo also produces libzerodds.a (staticlib). For single-binary deployment:
g++ ... target/release/libzerodds.a -lpthread -ldl -lm
Note: Linux needs -Wl,--gc-sections and -Wl,--as-needed for a minimal binary size.
System packages (DEB/RPM)
Pre-built packages at github.com/zero-objects/zero-dds/releases. Installation:
# Ubuntu/Debian
sudo apt install ./zerodds-core_1.0.0-rc.7_amd64.deb ./zerodds-cli_1.0.0-rc.7_amd64.deb ./zerodds-dev_1.0.0-rc.7_amd64.deb
# Fedora/RHEL: the rc.7 RPMs cannot be installed (zerodds-core requires libzerodds.so()(64bit), which no package provides); build from source, see the User Guide
# headers + libs land in /usr/include/zerodds + /usr/lib/
Typed topics — zerodds-idlc generate --lang c++
Instead of RawBytes you can publish IDL-defined structs directly. zerodds-idlc generate --lang c++ writes one header with the type, its XCDR2 codec and the dds::topic::topic_type_support<T> specialisation that zerodds/dds.hpp asks every topic type for. The codec calls the C++ wire runtime (runtime/cpp); the cpp-typed example shows the build.
Define the IDL (temperature.idl)
module sensor_msgs {
module msg {
struct Temperature {
long celsius;
string sensor_id;
};
};
};
Codegen
zerodds-idlc generate --lang c++ --out gen/ temperature.idl
# writes gen/temperature.hpp
Use it
#include "gen/temperature.hpp"
#include "zerodds/dds.hpp"
int main() {
zerodds::Runtime rt(0);
zerodds::TypedWriter<sensor_msgs::msg::Temperature> w(rt, "Temp");
sensor_msgs::msg::Temperature t{23, "A7"};
w.write(t);
}
Vendor spec: DDS-PSM-Cxx 1.0 spec coverage →
Tests & CI
cd crates/cpp/examples
./build_cpp_smoke.sh
# verifies: zerodds.h + zerodds/dds.hpp + pub/sub roundtrip
In the repo: crates/cpp/tests/