Skip to content

vlcrs-macros: add vlc_static_plugins #[cfg]

The vlc_static_plugins #[cfg] will be used to enforce suffixed vlc_entry_* functions naming, just like it is done in the plugin system when HAVE_DYNAMIC_PLUGINS is false, so that the modules generated from the rust buildsystem can also be linked into a static bundle of plugins.

Features were considered in the first iteration of the design, since they can allow crates using vlcrs-macros to require the static entrypoint generator from the Cargo.toml file directly, but features are supposed to be used additively and not behaviour-changing so that it doesn't matter if a dependency is using the crate with extra-features when it doesn't require so.

The additive design would have required to expose both the static_plugin feature and the dynamic_plugin feature, while allowing both to be enabled at the same time if needed, which meant generating two entrypoints on module!{} call.

Note that #[cfg(vlc_static_plugins)] is checked at the compile time of the module being built, and not the compile time of the vlcrs-macros proc-macro crate since the cfg would not be forwarded to the crate otherwise without a proper build.rs file. Both variant are thus generated with proper #[cfg()] in the output of the module!{} macro.

Future work will integrate that into autoconf and add a specific flag to force a suffixed-symbol to be generated regardless of #[cfg()] to be able to use that from the tests.

Merge request reports