Added SILC Thread Queue API
[silc.git] / lib / silcutil / tests / test_silcdll.c
1 /* SilcDll tests */
2
3 #include "silc.h"
4
5 int main(int argc, char **argv)
6 {
7   SilcBool success = FALSE;
8   SilcDll dll;
9   void *ptr;
10
11   if (argc > 1 && !strcmp(argv[1], "-d")) {
12     silc_log_debug(TRUE);
13     silc_log_quick(TRUE);
14     silc_log_debug_hexdump(TRUE);
15     silc_log_set_debug_string("*dll*,*errno*");
16   }
17
18   SILC_LOG_DEBUG(("Load shared object /lib/libc.so.6"));
19   dll = silc_dll_load("/lib/libc.so.6");
20   if (!dll) {
21     SILC_LOG_DEBUG(("Cannot load: %s", silc_dll_error(dll)));
22     goto err;
23   }
24
25   SILC_LOG_DEBUG(("Get symbol 'fprintf'"));
26   ptr = silc_dll_getsym(dll, "fprintf");
27   if (!ptr)
28     goto err;
29   SILC_LOG_DEBUG(("Symbol address %p", ptr));
30
31   SILC_LOG_DEBUG(("Close shared object"));
32   silc_dll_close(dll);
33
34   success = TRUE;
35
36  err:
37   SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE"));
38   fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE");
39
40   return success;
41 }