diff --git a/lib/src/phy/rf/rf_imp.c b/lib/src/phy/rf/rf_imp.c index 30ff775f0..1f754a403 100644 --- a/lib/src/phy/rf/rf_imp.c +++ b/lib/src/phy/rf/rf_imp.c @@ -94,11 +94,6 @@ const char* srsran_rf_get_devname(srsran_rf_t* rf) int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uint32_t nof_channels) { - if (srsran_rf_load_plugins() != SRSRAN_SUCCESS) { - ERROR("Failed to load RF plugins"); - return SRSRAN_ERROR; - } - rf->thread_gain_run = false; bool no_rf_devs_detected = true; @@ -482,3 +477,11 @@ int srsran_rf_load_plugins() #endif /* ENABLE_RF_PLUGINS */ return SRSRAN_SUCCESS; } + +// Search and load plugins when this library is loaded (shared) or right before main (static) +void __attribute__((constructor)) init() +{ + if (srsran_rf_load_plugins() != SRSRAN_SUCCESS) { + ERROR("Failed to load RF plugins"); + } +} diff --git a/lib/src/phy/rf/rf_zmq_test.c b/lib/src/phy/rf/rf_zmq_test.c index be42022e5..70d5704a5 100644 --- a/lib/src/phy/rf/rf_zmq_test.c +++ b/lib/src/phy/rf/rf_zmq_test.c @@ -233,7 +233,6 @@ int param_test(const char* args_param, const int num_channels) int main() { - srsran_rf_load_plugins(); // // two Rx ports // if (param_test("rx_port=ipc://dl0,rx_port1=ipc://dl1", 2)) { // fprintf(stderr, "Param test failed!\n");