22 lines
949 B
Rust
22 lines
949 B
Rust
pub mod cpu_service;
|
|
pub mod stats;
|
|
pub mod system_stats;
|
|
|
|
// cxx-qt 0.8.1's PluginType::Dynamic emits a QQmlEngineExtensionPlugin whose
|
|
// constructor only anchors qml_register_types_NovaStats with `volatile auto X = &X`
|
|
// (linker-keep, not a call), and the qmltyperegistrar static init doesn't call it
|
|
// either. Net effect: types never register, NS.* stays undefined in QML. Workaround:
|
|
// call it ourselves at .so load time. The function is mangled (returns void, no
|
|
// extern "C"), so go through #[link_name] using the itanium-mangled symbol seen in
|
|
// `nm libNovaStats.so | grep qml_register_types`.
|
|
unsafe extern "C" {
|
|
#[link_name = "_Z28qml_register_types_NovaStatsv"]
|
|
fn qml_register_types_nova_stats();
|
|
}
|
|
|
|
#[ctor::ctor(unsafe)]
|
|
fn on_dylib_load() {
|
|
eprintln!("[nova-plugin] dylib loaded (libNovaStats.so)");
|
|
unsafe { qml_register_types_nova_stats() };
|
|
eprintln!("[nova-plugin] qml_register_types_NovaStats called");
|
|
}
|