19 /* Change to the binary directory. */
20 if (chdir (OBJDIR
) != 0)
22 printf ("cannot change to `%s': %m", OBJDIR
);
26 wd
= getcwd (NULL
, 0);
28 buf
= alloca (strlen (wd
) + strlen (base
) + 5 + sizeof "testobj1.so");
30 printf ("loading `%s'\n", "./testobj1.so");
31 a
= dlopen ("./testobj1.so", RTLD_NOW
);
34 printf ("cannot load `./testobj1.so': %s\n", dlerror ());
38 stpcpy (stpcpy (stpcpy (buf
, "../"), base
), "/testobj1.so");
39 printf ("loading `%s'\n", buf
);
40 b
= dlopen (buf
, RTLD_NOW
);
43 printf ("cannot load `%s': %s\n", buf
, dlerror ());
47 stpcpy (stpcpy (buf
, wd
), "/testobj1.so");
48 printf ("loading `%s'\n", buf
);
49 c
= dlopen (buf
, RTLD_NOW
);
52 printf ("cannot load `%s': %s\n", buf
, dlerror ());
56 stpcpy (stpcpy (stpcpy (stpcpy (buf
, wd
), "/../"), base
), "/testobj1.so");
57 printf ("loading `%s'\n", buf
);
58 d
= dlopen (buf
, RTLD_NOW
);
61 printf ("cannot load `%s': %s\n", buf
, dlerror ());
65 if (a
!= b
|| b
!= c
|| c
!= d
)
67 puts ("shared object loaded more than once");