libdl-hp-ux.c 737 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * This is a fake version of the dynamic loading library for HP-UX.
  3. * We implement libdl using their shl_... routines.
  4. *
  5. * This is not currently used because we have no configuration test for
  6. * HP-UX.
  7. */
  8. #include "sysdep.h"
  9. #include <dl.h>
  10. #include <errno.h>
  11. static char *lasterror;
  12. char *
  13. dlerror(void)
  14. {
  15. char *res;
  16. res = lasterror;
  17. lasterror = NULL;
  18. return (res);
  19. }
  20. void *
  21. dlopen(char *name, int flags)
  22. {
  23. return (shl_load(name, BIND_IMMEDIATE, 0L));
  24. }
  25. int
  26. dlclose(void *lib)
  27. {
  28. return (shl_unload(lib));
  29. }
  30. void *
  31. dlsym(void *lib, char *name)
  32. {
  33. long res;
  34. if (shl_findsym((shl_t *)lib, name, TYPE_UNDEFINED, &res) == 0)
  35. return ((void *) res);
  36. else {
  37. lasterror = "Symbol not found";
  38. return (NULL); }
  39. }