5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "time.h" /* to seed the random generator */
12 #include "xbt/sysdep.h"
14 #include "xbt/dynar.h"
15 #include "xbt/config.h"
17 #include "xbt/module.h" /* this module */
19 #include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */
21 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
23 char *xbt_binary_name=NULL; /* Mandatory to retrieve neat backtraces */
24 int xbt_initialized=0;
26 /** @brief Initialize the xbt mechanisms. */
28 xbt_init(int *argc, char **argv) {
31 if (xbt_initialized!=1)
34 xbt_binary_name = xbt_strdup(argv[0]);
35 srand((unsigned int)time(NULL));
36 VERB0("Initialize XBT");
38 xbt_log_init(argc,argv);
41 /** @brief Finalize the xbt mechanisms. */
45 if (xbt_initialized == 0) {
46 free(xbt_binary_name);