-#ifndef APPLE
-// FIXME
-// On Apple this error occurs:
-// Undefined symbols for architecture x86_64:
-// "_on_exit", referenced from:
-// _smpi_register_static in smpi_c99.c.o
- on_exit(&smpi_free_static, arg);
-#endif
+void smpi_free_static(void)
+{
+ while (!xbt_dynar_is_empty(registered_static_stack)) {
+ void *p = xbt_dynar_pop_as(registered_static_stack, void*);
+ free(p);
+ }
+ xbt_dynar_free(®istered_static_stack);