Hey all,

I recently learned that my understanding of how symbol visibility works, and 
how one is supposed to use the export macros we all know from Qt and KDE (and 
that I have used for the last ~20 years) is incorrect for clang/libc++. This 
is mostly a PSA at this stage only, as I cannot yet accurately give a 
meaningful suggestion of what to do instead. 

Please see https://github.com/llvm/llvm-project/issues/133725 for more details 
and the ongoing discussion. I'm trying to learn more, and get more 
documentation from the clang/libc++ folks. At the very least, the following 
part of Qt knowledge is _wrong_ for that specific target platform:

> Never export a non-polymorphic class wholesale
(From https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews)

Because if you do so, and the type is public (i.e. all-inline), then you would 
not be able to safely put that into a `std::any` in one DSO and extract it in 
another DSO. The worst thing is that this is only detectable at runtime. In 
the context of Qt, maybe not a lot of people use std::any (yet?), but being 
compatible with std types should be paramount I hope you all agree. So maybe a 
separate macro needs to be added for `[[clang::type_visibility]]` and added to 
all public types, until https://github.com/llvm/llvm-project/issues/133905 
lands and we can use it to set this globally?

Cheers
-- 
Milian Wolff
m...@milianw.de
http://milianw.de

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to