If you enable the clang warning "-Wweak-vtables" on any particular library in the system, you'll see dozens of classes in each Library that fire this warning. In particular, LibCore, LibJS, LibWeb and LibGUI
Why does this matter? Well, it only matters if the specific class you want to use is:
dlopen
d at runtime, after the dynamic loader has resolved symbols for the main exectuablecatch
clauseThis doesn't apply to .. most of our libraries, in most cases.
However! It does apply on Android. On Android, native libraries must be loaded via System.loadLibrary
after the android runtime has initialized your application. This means that if we use dlopen (which System.loadLibrary
does under the hood) to load ladybird.so
or webcontent.so
(which is mandatory), and then those shared libraries depend on our standard shlibs like liblagom-web.so, liblagom-js.so, any dynamic_cast
s across shlib boundaries will fail.
For more on why, see https://developer.android.com/ndk/guides/common-problems#rttiexceptions_not_working_across_library_boundaries
The net result is that we must compile Lagom as static libraries on Android. This isn't the end of the world, but it also means that if we add dlopen
to our apps at any time in the future, we need to make 100% sure that any classes that have dynamic_cast() applied to them in the dynamically opened shlib have key functions or are not polymorphic.
I'm not sure how worth it is to actually fix this, unless we start running into problems with libs that must be dlopened.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too