1 /* This program uses HP-UX-specific features to load and unload SOM
2 shared libraries that it wasn't linked against (i.e., libraries
3 that the loader doesn't automatically load along with the program
15 int (*solib_main
) (int);
17 /* Load a shlib, with immediate binding of all symbols.
19 Note that the pathname of the loaded shlib is assumed to be relative
20 to the testsuite directory (from whence the tested GDB is run), not
23 dummy
= 1; /* Put some code between shl_ calls... */
24 solib_handle
= shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE
, 0);
26 /* Find a function within the shlib, and call it. */
27 status
= shl_findsym (&solib_handle
,
30 (long *) &solib_main
);
31 status
= (*solib_main
) (dummy
);
33 /* Unload the shlib. */
34 status
= shl_unload (solib_handle
);
36 /* Load a different shlib, with deferred binding of all symbols. */
38 solib_handle
= shl_load ("gdb.base/solib2.sl", BIND_DEFERRED
, 0);
40 /* Find a function within the shlib, and call it. */
41 status
= shl_findsym (&solib_handle
,
44 (long *) &solib_main
);
45 status
= (*solib_main
) (dummy
);
47 /* Unload the shlib. */
48 status
= shl_unload (solib_handle
);
50 /* Reload the first shlib again, with deferred symbol binding this time. */
52 solib_handle
= shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE
, 0);
54 /* Unload it without trying to find any symbols in it. */
55 status
= shl_unload (solib_handle
);