naspro

view naspro-bridges-bad/cmake/CheckLibraryLoads.c @ 174:4f7243a606b1

Updated copyright notices and build system
author Stefano D'Angelo <zanga.mail@gmail.com>
date Sat May 01 21:51:33 2010 +0300 (2010-05-01)
parents
children
line source
1 #include <stdio.h>
2 #include <dlfcn.h>
4 /**
5 * Attempts to load shared libraries
6 * @param argc
7 * @param argv files to check (pass only shared libs)
8 * @return 0 - all shared libs loaded, 1 - error occured (invalid or broken files passed)
9 */
10 int main(int argc, char* argv[])
11 {
12 int i;
13 for (i = 1; i < argc; ++i) {
14 void* handle = dlopen(argv[i], RTLD_NOW);
15 if (!handle) {
16 fprintf(stderr, "%s", dlerror());
17 return 1;
18 } else {
19 dlclose(handle);
20 }
21 }
22 return 0;
23 }