-#endif
-
-#endif
-
-static void xbt_preinit()
-{
- unsigned int seed = 2147483647;
-#ifdef _WIN32
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- xbt_pagesize = si.dwPageSize;
-#elif HAVE_SYSCONF
- xbt_pagesize = sysconf(_SC_PAGESIZE);
-#else
-# error Cannot get page size.
-#endif
-
- xbt_pagebits = log2(xbt_pagesize);
-
-#ifdef _TWO_DIGIT_EXPONENT
- /* Even printf behaves differently on Windows... */
- _set_output_format(_TWO_DIGIT_EXPONENT);
-#endif
- xbt_log_preinit();
- xbt_os_thread_mod_preinit();
- xbt_dict_preinit();
-
- srand(seed);
-#ifndef _WIN32
- srand48(seed);
-#endif
- atexit(xbt_postexit);
-}
-
-static void xbt_postexit()
-{
- if (not _sg_do_clean_atexit)
- return;
- xbt_initialized--;
- xbt_dict_postexit();
- xbt_os_thread_mod_postexit();
- xbt_dynar_free(&xbt_cmdline);
- xbt_log_postexit();
-#if SIMGRID_HAVE_MC
- mmalloc_postexit();
-#endif
-}
-
-/** @brief Initialize the xbt mechanisms. */
-void xbt_init(int *argc, char **argv)
-{
- simgrid::xbt::install_exception_handler();
-
- xbt_initialized++;
- if (xbt_initialized > 1) {
- XBT_DEBUG("XBT has been initialized %d times.", xbt_initialized);
- return;
- }
-
- xbt_binary_name = argv[0];
- xbt_cmdline = xbt_dynar_new(sizeof(char*), NULL);
- for (int i = 0; i < *argc; i++)
- xbt_dynar_push(xbt_cmdline,&(argv[i]));
-
- xbt_log_init(argc, argv);