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 idlc cpp 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.3)
Direkt-Download von GitHub Releases v1.0.0-rc.3:
# Ubuntu/Debian (amd64 / arm64)
wget https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-dev_1.0.0-rc.3_amd64.deb
sudo dpkg -i zerodds-dev_1.0.0-rc.3_amd64.deb
# Fedora/RHEL (x86_64)
sudo dnf install https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-devel-1.0.0-0.rc1.fc40.x86_64.rpm
# Windows
# zerodds-1.0.0-x64.msi (Doppelklick oder msiexec /i)
# Portable tarball (Linux/macOS, alle 7 Targets)
curl -L https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-cli-x86_64-unknown-linux-gnu.tar.xz | tar -xJ
Paketmanager
# macOS — Homebrew Tap
brew tap zero-objects/zerodds
brew install zerodds
# Arch Linux — AUR
yay -S zerodds-bin # Binary-Variante (schneller)
yay -S zerodds # Source-Build über makepkg
# Docker (CLI + bridges)
docker pull fishermen21/zerodds-cli
Noch nicht live: APT-Repo (apt install zerodds) und Chocolatey/Scoop. .deb/.rpm/.msi oben gehen aber heute schon.
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/PKG/MSI)
Pre-built Pakete unter github.com/zero-objects/zero-dds/releases. Installation:
# Ubuntu/Debian
sudo apt install ./zerodds_1.0.0-rc.3_amd64.deb
# Fedora/RHEL
sudo dnf install ./zerodds-1.0.0-rc.3.x86_64.rpm
# Header + libs landen in /usr/include/zerodds + /usr/lib/
Typisierte Topics — idlc cpp
Statt RawBytes kannst du IDL-definierte Strukturen direkt publizieren. idlc cpp emittiert DDS-PSM-Cxx-konforme Header.
IDL definieren (temperature.idl)
module sensor_msgs {
module msg {
struct Temperature {
long celsius;
string sensor_id;
};
};
};
Codegen
idlc cpp temperature.idl -o gen/
# erzeugt gen/sensor_msgs/msg/Temperature.hpp + .cpp
Nutzen
#include "gen/sensor_msgs/msg/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 idlc cpp 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.3)
Direct download from GitHub Releases v1.0.0-rc.3:
# Ubuntu/Debian (amd64 / arm64)
wget https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-dev_1.0.0-rc.3_amd64.deb
sudo dpkg -i zerodds-dev_1.0.0-rc.3_amd64.deb
# Fedora/RHEL (x86_64)
sudo dnf install https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-devel-1.0.0-0.rc1.fc40.x86_64.rpm
# Windows
# zerodds-1.0.0-x64.msi (double-click or msiexec /i)
# Portable tarball (Linux/macOS, all 7 targets)
curl -L https://github.com/zero-objects/zero-dds/releases/download/v1.0.0-rc.3/zerodds-cli-x86_64-unknown-linux-gnu.tar.xz | tar -xJ
Package managers
# macOS — Homebrew tap
brew tap zero-objects/zerodds
brew install zerodds
# Arch Linux — AUR
yay -S zerodds-bin # binary variant (faster)
yay -S zerodds # source build via makepkg
# Docker (CLI + bridges)
docker pull fishermen21/zerodds-cli
Not live yet: the APT repo (apt install zerodds) and Chocolatey/Scoop. The .deb/.rpm/.msi above already work today.
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/PKG/MSI)
Pre-built packages at github.com/zero-objects/zero-dds/releases. Installation:
# Ubuntu/Debian
sudo apt install ./zerodds_1.0.0-rc.3_amd64.deb
# Fedora/RHEL
sudo dnf install ./zerodds-1.0.0-rc.3.x86_64.rpm
# headers + libs land in /usr/include/zerodds + /usr/lib/
Typed topics — idlc cpp
Instead of RawBytes you can publish IDL-defined structs directly. idlc cpp emits DDS-PSM-Cxx-conformant headers.
Define the IDL (temperature.idl)
module sensor_msgs {
module msg {
struct Temperature {
long celsius;
string sensor_id;
};
};
};
Codegen
idlc cpp temperature.idl -o gen/
# produces gen/sensor_msgs/msg/Temperature.hpp + .cpp
Use it
#include "gen/sensor_msgs/msg/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/