microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.24k stars 1.13k forks source link

Building With RTTI #12373

Open NickGerleman opened 10 months ago

NickGerleman commented 10 months ago

Right now react-native mostly tries to avoid RTTI. RN libraries for Android inside of Meta are built with -fno-rtti, but all other internal and OSS builds use -frtti.

Meta's Android build is now moving to globally use -frtti, and JSI was built with RTTI in mind. It is possible we will more broadly allow RTTI usage in RN in the future.

React Native Windows right now disables RTTI in release builds.

chrisglein commented 9 months ago

Related: https://github.com/microsoft/react-native-windows/issues/2974 https://github.com/microsoft/react-native-windows/issues/7981

@NickGerleman Do you have a timeline for when you think it'll become a problem for RNW to not be building with RTTI? We'll want to measure the impact of including this again.

NickGerleman commented 9 months ago

The Android switch to RTTI on in Meta apps is already being tested. There aren't current plans to add explicit RTTI usage (beyond existing JSI APIs), but it will likely come sometime after.

NickGerleman commented 8 months ago

Heads up that the changes landed so that all of Meta's builds have RTTI enabled.

We haven't added more usage of it yet, but do explicitly want to replace e.g. traitCast with dynamic_cast.