Overview
The FFI layer (ffi/ directory) exposes core IronRDP functionality:
- Connection management
- Session handling
- Graphics processing
- Input events
- Clipboard operations
- Virtual channels (DVC)
- CredSSP authentication
Building FFI Bindings
# Ubuntu/Debian
sudo apt install dotnet-sdk-8.0
# macOS
brew install dotnet
# Windows
winget install Microsoft.DotNet.SDK.8
# Debug build
cargo xtask ffi build
# Release build (recommended for production)
cargo xtask ffi build --release
Using .NET Bindings
Basic Connection Example
Here’s a complete .NET example:Sending Input Events
Clipboard Operations
Graphics Rendering to Bitmap
Error Handling
Running .NET Examples
Console Example
Avalonia GUI Example
The FFI directory includes a full GUI example using Avalonia:- Window management
- Graphics rendering
- Input handling
- Full RDP client UI
Advanced Usage
Custom TLS Configuration
Dynamic Virtual Channels
RDCleanPath Parsing
Building for Other Languages
While .NET is officially supported, Diplomat can generate bindings for:- C/C++ - Generate header files
- JavaScript - Via WebAssembly (see WebAssembly guide)
- Python - Community-contributed bindings
Generating C Headers
target/diplomat/.
Memory Management
.NET Resource Disposal
Always dispose IronRDP objects:Troubleshooting
Library Not Found
Ensure the native library is in the correct location:Version Mismatch
Regenerate bindings after updating IronRDP:Debugging FFI Calls
Enable logging on both sides:Production Deployment
Packaging Native Library
Include the native library with your .NET application:Cross-Platform Distribution
Next Steps
- Building a Client - Understand the underlying Rust API
- WebAssembly - Use IronRDP in web browsers
- Virtual Channels - Implement custom channels via FFI

