URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 156 |
Rev 816 |
#include <stdio.h>
|
#include <stdio.h>
|
#include <dlfcn.h>
|
#include <dlfcn.h>
|
|
|
int bar = -20;
|
int bar = -20;
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
int ret = 0;
|
int ret = 0;
|
void *handle;
|
void *handle;
|
void (*fcn) (void);
|
void (*fcn) (void);
|
|
|
handle = dlopen("./tmpdir/libdl6a.so", RTLD_GLOBAL|RTLD_LAZY);
|
handle = dlopen("./tmpdir/libdl6a.so", RTLD_GLOBAL|RTLD_LAZY);
|
if (!handle)
|
if (!handle)
|
{
|
{
|
printf("dlopen ./tmpdir/libdl6a.so: %s\n", dlerror ());
|
printf("dlopen ./tmpdir/libdl6a.so: %s\n", dlerror ());
|
return 1;
|
return 1;
|
}
|
}
|
|
|
fcn = (void (*)(void)) dlsym(handle, "foo");
|
fcn = (void (*)(void)) dlsym(handle, "foo");
|
if (!fcn)
|
if (!fcn)
|
{
|
{
|
printf("dlsym foo: %s\n", dlerror ());
|
printf("dlsym foo: %s\n", dlerror ());
|
ret += 1;
|
ret += 1;
|
}
|
}
|
else
|
else
|
{
|
{
|
(*fcn) ();
|
(*fcn) ();
|
}
|
}
|
|
|
dlclose (handle);
|
dlclose (handle);
|
return ret;
|
return ret;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.