cfb8: Fix decrypt path
[gd/nettle] / testsuite / dlopen-test.c
1 #include "testutils.h"
2 #include "version.h"
3
4 #if HAVE_DLFCN_H
5 #include <dlfcn.h>
6 #endif
7
8 #ifdef __APPLE__
9 #define SO_EXT "dylib"
10 #else
11 #define SO_EXT "so"
12 #endif
13
14 int
15 main (int argc UNUSED, char **argv UNUSED)
16 {
17 #if HAVE_LIBDL
18   void *handle = dlopen ("../libnettle." SO_EXT, RTLD_NOW);
19   int (*get_version)(void);
20   if (!handle)
21     {
22       fprintf (stderr, "dlopen failed: %s\n", dlerror());
23       FAIL ();
24     }
25
26   get_version = (int(*)(void)) dlsym (handle, "nettle_version_minor");
27   if (!get_version)
28     {
29       fprintf (stderr, "dlsym failed: %s\n", dlerror());
30       FAIL ();
31     }
32   if (get_version() != NETTLE_VERSION_MINOR)
33     {
34       fprintf (stderr, "unexpected nettle version\n");
35       FAIL ();
36     }
37   dlclose (handle);
38   return EXIT_SUCCESS;
39 #else
40   SKIP();
41 #endif
42 }