+XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap_unit);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_cbps);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_convert);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_create);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_exchange);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_lexer);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_parse);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_trp);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_trp_meas);
+
+int _surf_do_model_check = 0; /* this variable is used accros the libraries, and must be declared in XBT so that it's also defined in GRAS (not only in libsimgrid) */
+
+/* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
+ * This is crude and rather compiler-specific, unfortunately.
+ */
+static void xbt_preinit(void) _XBT_GNUC_CONSTRUCTOR;
+static void xbt_postexit(void) _XBT_GNUC_DESTRUCTOR;
+
+#ifdef _XBT_WIN32
+# undef _XBT_NEED_INIT_PRAGMA
+#endif
+
+#ifdef _XBT_NEED_INIT_PRAGMA
+#pragma init (xbt_preinit)
+#pragma fini (xbt_postexit)
+#endif
+
+#ifdef _XBT_WIN32
+#include <windows.h>
+
+#ifndef __GNUC__
+/* Dummy prototype to make gcc happy */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
+ LPVOID lpvReserved);
+
+/* Should not be necessary but for some reason,
+ * DllMain is called twice at attachment and
+ * at detachment.*/
+static int xbt_dll_process_is_attached = 0;
+
+/* see also http://msdn.microsoft.com/en-us/library/ms682583%28VS.85%29.aspx */
+/* and http://www.microsoft.com/whdc/driver/kernel/DLL_bestprac.mspx */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
+ LPVOID lpvReserved)