Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
69b1db4c5e2dc8a294b1960d1c60af2d0aa6a5da
[simgrid.git] / src / xbt / module.c
1 /* $Id$ */
2
3 /* module handling                                                          */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
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. */
9
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 #include "xbt/dynar.h"
13 #include "xbt/config.h"
14
15 #include "xbt/module.h" /* this module */
16
17 #include "xbt_modinter.h"  /* prototype of other module's init/exit in XBT */
18
19 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
20
21 char *xbt_binary_name=NULL; /* Mandatory to retrieve neat backtraces */
22
23 struct xbt_module_ {
24   xbt_dynar_t *deps;
25   xbt_cfg_t *cfg;
26   int ref;
27   xbt_module_new_fct_t new;
28   xbt_module_finalize_fct_t finalize;
29 };
30
31 /** @brief Initialize the xbt mechanisms. */
32 void 
33 xbt_init(int *argc, char **argv) {
34   static short int first_run = 1;
35   if (!first_run)
36     return;
37
38   xbt_binary_name = strdup(argv[0]);
39   first_run = 0;
40   VERB0("Initialize XBT");
41   
42   xbt_log_init(argc,argv);
43 }
44
45 /** @brief Finalize the xbt mechanisms. */
46 void 
47 xbt_exit(){
48   xbt_log_exit();
49 }
50