summaryrefslogtreecommitdiff
path: root/src/bin/eina/eina_modinfo.c
blob: 9457ba15bd0b7d24a350e797eea77bc70fb2ec59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* EINA - EFL data type library
 * Copyright (C) 2016 Amitesh Singh
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library;
 * if not, see <http://www.gnu.org/licenses/>.
 */

#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char **argv)
{
   void *lib;

   if (argc != 2)
     {
        fprintf(stderr, "Error: Missing module or filename\n");
        return 1;
     }

   lib = dlopen(argv[1], RTLD_LAZY);
   if (!lib)
     {
        fprintf(stderr, "Error: Failed to open: %s\n", argv[1]);
        return 2;
     }

   printf("version:\t%s\n", (char *)dlsym(lib, "__EINA_MODULE_UNIQUE_ID_ver"));
   printf("description:\t%s\n", (char *)dlsym(lib, "__EINA_MODULE_UNIQUE_ID_desc"));
   printf("license:\t%s\n", (char *)dlsym(lib, "__EINA_MODULE_UNIQUE_ID_license"));
   printf("author:\t%s\n", (char *)dlsym(lib, "__EINA_MODULE_UNIQUE_ID_author"));

   dlclose(lib);

   return 0;
}