diff options
Diffstat (limited to 'src/bin/eina/eina_modinfo.c')
-rw-r--r-- | src/bin/eina/eina_modinfo.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/bin/eina/eina_modinfo.c b/src/bin/eina/eina_modinfo.c new file mode 100644 index 0000000000..9457ba15bd --- /dev/null +++ b/src/bin/eina/eina_modinfo.c @@ -0,0 +1,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; +} |