Skip to main content

Installing HDDS on Windows

This guide covers installing HDDS from source on Windows 10 and Windows 11.

Prerequisites

  • Windows 10 1903+ or Windows 11
  • Rust 1.75+: rustup.rs
  • Git

You have two options for the Rust toolchain:

Requires Visual Studio 2019+ with C++ workload.

# Install Rust via winget
winget install Rustlang.Rust.MSVC

# Or via rustup
Invoke-WebRequest -Uri https://win.rustup.rs -OutFile rustup-init.exe
.\rustup-init.exe

# Verify Rust version
rustc --version # Should be 1.75.0 or higher

Option B: GNU Target (No Visual Studio required)

Ideal for headless/CI environments, SSH-based builds, or when Visual Studio is not available (e.g., Windows LTSC editions).

# Install Rust via rustup
Invoke-WebRequest -Uri https://win.rustup.rs -OutFile rustup-init.exe
.\rustup-init.exe

# Switch to GNU target
rustup default stable-x86_64-pc-windows-gnu

# Install mingw-w64 (provides the GNU linker)
# Download from https://github.com/niXman/mingw-builds-binaries/releases
# Extract to C:\mingw64 and add to PATH:
$env:PATH += ";C:\mingw64\bin"

# Verify
rustc --version
gcc --version
GNU target for SSH/CI

The GNU target works out of the box in SSH sessions where the MSVC vcvarsall.bat environment is not loaded. This makes it the preferred choice for automated builds and CI pipelines on Windows.

Clone and Build

# Clone the repository
git clone https://git.hdds.io/hdds/hdds.git
cd hdds

# Build in release mode
cargo build --release

# Run tests to verify
cargo test

Using HDDS in Your Project

Add HDDS as a path dependency in your project's Cargo.toml:

[dependencies]
hdds = { path = "C:/path/to/hdds/crates/hdds" }

With optional features:

[dependencies]
hdds = { path = "C:/path/to/hdds/crates/hdds", features = ["xtypes", "security"] }

Available Features

FeatureDescription
xtypesXTypes type system (default)
securityDDS Security 1.1 support
tcp-tlsTLS encryption for TCP transport
cloud-discoveryAWS/Azure/Consul discovery
k8sKubernetes discovery
rpcDDS-RPC Request/Reply
telemetryMetrics collection

Code Generator (hddsgen)

# Clone hdds_gen
git clone https://git.hdds.io/hdds/hdds_gen.git
cd hdds_gen

# Build
cargo build --release

# Add to PATH (optional)
$env:PATH += ";$(Get-Location)\target\release"

# Verify
.\target\release\hddsgen.exe --version

Quick Start with hddsgen

Generate a complete pub/sub project from an IDL file:

# Generate a Rust project with publisher/subscriber examples
hddsgen gen rust --input my_types.idl --output C:\my_dds_project `
--example --build-system cargo

cd C:\my_dds_project

# Build
cargo build

# Run publisher in one terminal
cargo run --bin publisher

# Run subscriber in another terminal
cargo run --bin subscriber
Path separators in generated Cargo.toml

If HDDS is referenced as a path dependency, ensure the generated Cargo.toml uses forward slashes (C:/path/to/hdds) rather than backslashes. Cargo on Windows accepts forward slashes and they avoid escaping issues.

C/C++ Development

Visual Studio

After building HDDS:

# Build the C bindings
cd C:\path\to\hdds
cargo build --release -p hdds-c

# The library will be at target\release\hdds.dll

Configure project properties:

Include Directories:

C:\path\to\hdds\sdk\c\include

Library Directories:

C:\path\to\hdds\target\release

Linker Input:

hdds.dll.lib

CMake

# Point to your HDDS build
set(HDDS_ROOT "C:/path/to/hdds")

add_executable(myapp main.cpp)
target_include_directories(myapp PRIVATE ${HDDS_ROOT}/sdk/c/include)
target_link_directories(myapp PRIVATE ${HDDS_ROOT}/target/release)
target_link_libraries(myapp PRIVATE hdds)

Configure with:

cmake -B build
cmake --build build --config Release

Verify Installation

# Run tests
cargo test -p hdds --lib

# Build and check hddsctl
cargo build --release -p hddsctl
.\target\release\hddsctl.exe --help

Windows Firewall Configuration

DDS uses UDP multicast. Configure Windows Firewall:

Using PowerShell (Administrator)

# Allow HDDS through firewall
New-NetFirewallRule -DisplayName "HDDS DDS" `
-Direction Inbound `
-Protocol UDP `
-LocalPort 7400-7500 `
-Action Allow

# Or for your specific application
New-NetFirewallRule -DisplayName "My DDS App" `
-Program "C:\path\to\your\app.exe" `
-Action Allow

Using GUI

  1. Open Windows SecurityFirewall & network protection
  2. Click Allow an app through firewall
  3. Click Change settingsAllow another app
  4. Add your application or allow ports 7400-7500 UDP

Multicast Configuration

Windows supports multicast by default on most networks. Verify:

# Check route table
route print | findstr 239

# If multicast isn't working, try:
route add 239.255.0.0 mask 255.255.0.0 192.168.1.1
VPN and Virtual Adapters

VPNs and virtual network adapters (VMware, VirtualBox, Docker) can interfere with multicast. Try disabling them for testing.

Shared Memory Transport (Windows)

HDDS supports zero-copy shared memory (SHM) transport on Windows using CreateFileMappingW/MapViewOfFile for memory segments and WaitOnAddress/ WakeByAddressAll for synchronization (Windows 8+).

SHM is automatically used when two participants are on the same host. No configuration required.

use hdds::{Participant, TransportMode};
use hdds::transport::shm::ShmPolicy;

let participant = Participant::builder("my_app")
.with_transport(TransportMode::UdpMulticast)
.shm_policy(ShmPolicy::Prefer) // default: use SHM when available
.build()?;
SHM Segment Cleanup

On Windows, shared memory segments are automatically cleaned up by the OS when all processes that mapped them exit. Unlike Linux (/dev/shm), there are no persistent files to worry about.

WSL2 Considerations

WSL2 runs in a separate virtual network. UDP multicast between WSL2 and the Windows host does not work out of the box. For DDS development on Windows, prefer native Windows builds over WSL2.

If you must use WSL2, configure networkingMode=mirrored in .wslconfig (Windows 11 22H2+) for shared network interfaces.

Network/Shared Drives (VirtualBox, SMB)

When building HDDS from a network share or VirtualBox shared folder (e.g., X:\), the Cargo target directory resolves to a UNC path (\\VBoxSvr\share\...) which the GNU linker cannot handle. Override the target directory to a local path:

# Set a local target directory
$env:CARGO_TARGET_DIR = "C:\hdds-target"

# Now build normally from the shared folder
cd X:\hdds
cargo build --release
UNC paths

This is only needed when the source code lives on a network share. Local paths (e.g., C:\hdds) work without any workaround.

Troubleshooting

"DLL not found" Error

# Add HDDS to PATH
$env:PATH += ";C:\Program Files\HDDS\bin"

# Or copy DLLs to application directory
copy "C:\Program Files\HDDS\bin\hdds.dll" .\

"Access Denied" on Ports

Run as Administrator or use ports above 1024.

Multicast Not Working

# Check if multicast is enabled on your adapter
Get-NetAdapter | Get-NetIPInterface | Select-Object InterfaceAlias, InterfaceMetric

# Disable firewall temporarily for testing
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

"dlltool.exe not found" (GNU Target)

The GNU target requires mingw-w64. Install it and add to PATH:

# Verify mingw is in PATH
gcc --version

# If not found, add it:
$env:PATH += ";C:\mingw64\bin"

Visual Studio Linker Errors

Ensure your project architecture matches the Rust build target:

  • x64 project → build with cargo build --release (default on 64-bit Windows)
  • x86 project → build with cargo build --release --target i686-pc-windows-msvc

The import library (hdds.dll.lib) and DLL are both in target/release/.

Next Steps