• search hit 46 of 586
Back to Result List

Integrating the future into the past

  • The goal of this thesis is to provide a guide that can be used by software developers that wants to include Rust into an existing C++ application. After a brief summary of the languages, both the basics of integrating Rust code into C++ applications and the reverse way are presented to set a common base of knowledge. Additionally, a few tools and libraries are introduced, namely bindgen, cbindgen, cxx, and the cc crate. As they are being used in the following guide, the toolsets CMake and CMakeRust are presented and explained in more detail to make it easier for developers to include and use them in their own projects. The guide is separated into three steps which help to identify the required interfaces, implement them and eventually include everything into the C++ compilation process. Apart from more advanced types based on pointers, the integration is fairly easy and straight-forward. Using structs and their implemented methods, Rust is able to replicate a class structure that is typical for object-oriented C++. AfterThe goal of this thesis is to provide a guide that can be used by software developers that wants to include Rust into an existing C++ application. After a brief summary of the languages, both the basics of integrating Rust code into C++ applications and the reverse way are presented to set a common base of knowledge. Additionally, a few tools and libraries are introduced, namely bindgen, cbindgen, cxx, and the cc crate. As they are being used in the following guide, the toolsets CMake and CMakeRust are presented and explained in more detail to make it easier for developers to include and use them in their own projects. The guide is separated into three steps which help to identify the required interfaces, implement them and eventually include everything into the C++ compilation process. Apart from more advanced types based on pointers, the integration is fairly easy and straight-forward. Using structs and their implemented methods, Rust is able to replicate a class structure that is typical for object-oriented C++. After providing the required binding files, the Rust component can easily be called from C++ code like any other function. While external Rust methods need to be called using a function(Object) syntax, they can be also be converted and used via the standard Object.function() syntax by implementing wrapper classes that translate the calls. These can then be included in more complex C++ architectures like inheritance structures. The usage of the aforementioned advanced types, which are based on pointers, is not covered in this thesis, though the cxx library can be used for those. The compilation for and usage on embedded targets is also possible with its required effort depending on the target architecture. If the necessary target is not officially supported yet, some additional things like the standard library need to be downloaded and compiled manually. The thesis comes to the conclusion that considering C++ is not officially supported by the Rust FFI, it works very well with the C ABI and apart from one floating point type, no clear limitations or incompatibilities were identified. For interfaces that only work with basic types and to get a general understanding of the topic, this thesis is a good starting point and guide for a developer who is new to the topic.show moreshow less

Download full text files

Export metadata

Additional Services

Search Google Scholar
Metadaten
Author:Philipp Christian Graf von Perponcher-Sedlnitzki
Subtitle (English):Approach to seamlessly integrate newly-developed Rust-components into an existing C++-system
Language:English
Document Type:Master's Thesis
Reviewer(s) at THI:Sebastian Apel, Hans-Michael Windisch
Publishing Institution:Technische Hochschule Ingolstadt
Date of first Publication:2024/01/17
Year of first Publication:2024
Place of publication:Ingolstadt
Pages:vi, 99
URN:urn:nbn:de:bvb:573-45429
Faculties / Institutes / Organizations:Fakultät Informatik
Degree Programmes:Informatik (M. Sc.)
Licence (German):License Logo Urheberrechtsschutz
Release Date:2024/03/01