Closed XiaoPengYouCode closed 3 weeks ago
Sometimes even GCC and Clang will mangle the same name in different ways. The most notable case is lambda, but other cases may also exist. And even with the same compiler, it may change with the compiler version since there is no guarantee.
In my opinion, the full type name should really not be used to identify the schema, even in Rust. Using it would couple the project structure with the implementation and is quite unexpected.
See also #480. We are on it but it will take some time until it will work seamlessly.
Yes I have see the discussion, I will close this issue!
Apart from the memory layout, iceoryx2 also requires the type name to be the same.
The Rust side uses
core::any::type_name()
to get the undecorated name, like"std::option::Option<std::string::String>"
:https://github.com/eclipse-iceoryx/iceoryx2/blob/a657228f03d9a7ed040616cedff940b43bd447a1/iceoryx2/src/service/static_config/message_type_details.rs#L44-L56
However, the C++ side uses
typeid().name
, whose format is undefined and left to the compiler. Acoording to this question, on GCC/Clang it's the mangled name, while on MSVC it's the demangled name. So the type name is not only different from Rust and C++, but also different from GCC/Clang and MSVC.https://github.com/eclipse-iceoryx/iceoryx2/blob/a657228f03d9a7ed040616cedff940b43bd447a1/iceoryx2-ffi/cxx/include/iox2/message_type_details.hpp#L21-L42
Unfortunately, looks like there is currently no way in iceoryx2 to customize the type name.
Originally posted by @Chaoses-Ib in https://github.com/eclipse-iceoryx/iceoryx2/discussions/480#discussioncomment-10972638