>>>>> "Martin" == Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
>>>>> writes:
Martin> Do you (or anybody else) know if there is a generic way to
Martin> test for -rdynamic? The scsh configure.in has this code to
Martin> decide whether to link with -rdynamic or not:
Here's a quick C program that tests for the symptoms of missing
-rdynamic on NetBSD (very recent -current) and Linux (Debian
3.0ish). On both boxes, without -rdynamic, the global symbol
"export_test" is not found (and a non-zero exit code is
returned). It needs to be compiled with -ldl on Linux (and probably
Solaris).
- S
--- SNIP ------ SNIP ------ SNIP ------ SNIP ------ SNIP ------ SNIP ---
#include <stdio.h>
#include <dlfcn.h>
#ifndef RTLD_LAZY
#define RTLD_LAZY 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
int export_test = 0;
int
main(void)
{
void *dlhandle;
void *intp;
char *err;
dlhandle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1;
}
(void *)intp = dlsym(dlhandle, "export_test");
if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1;
}
return 0;
}
--- SNIP ------ SNIP ------ SNIP ------ SNIP ------ SNIP ------ SNIP ---
|