-s_surf_model_description_t surf_plugin_description[] = {
- {"host_energy", "Cpu energy consumption.", &sg_host_energy_plugin_init},
- {"link_energy", "Link energy consumption.", &sg_link_energy_plugin_init},
- {"host_load", "Cpu load.", &sg_host_load_plugin_init},
- {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
-};
+ /* no need to check for plugin name conflict: the compiler already ensures that the generated
+ * simgrid_##id##_plugin_register() is unique */
+
+ plugin_amount++;
+ surf_plugin_description = static_cast<s_surf_model_description_t*>(
+ xbt_realloc(surf_plugin_description, sizeof(s_surf_model_description_t) * (plugin_amount + 2)));
+
+ surf_plugin_description[plugin_amount - 1] = {name, description, init_fun};
+ surf_plugin_description[plugin_amount] = {nullptr, nullptr, nullptr}; // this array must be null terminated
+}