suse-hpc/dlinfo.c
Egbert Eich 41ac4d7eb4 Accepting request 525945 from home:eeich:hpc_alt
- Add a dependency generator wrapper for binaries and libraries
  to avoid adding standard dependencies for HPC libraries.

- Removed unneeded BuildRequires:

OBS-URL: https://build.opensuse.org/request/show/525945
OBS-URL: https://build.opensuse.org/package/show/science:HPC/suse-hpc?expand=0&rev=3
2017-09-13 22:51:52 +00:00

28 lines
491 B
C

#define _GNU_SOURCE
#include <dlfcn.h>
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
void *dlh;
struct link_map *linkmap;
if (argc != 2) {
fprintf(stderr, "Usage: %s <library>\n", argv[0]);
exit(EXIT_FAILURE);
}
if ((dlh = dlopen(argv[1], RTLD_NOW)) == NULL)
exit(EXIT_FAILURE);
if (dlinfo(dlh, RTLD_DI_LINKMAP, &linkmap) == -1)
exit(EXIT_FAILURE);
printf("%s\n",linkmap->l_name);
exit(EXIT_SUCCESS);
}