mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 04:01:10 +00:00
1a511d3105
2000-12-15 Andreas Jaeger <aj@suse.de> * stdio-common/scanf9.c (main): Reformat and change to avoid warnings. * stdio-common/tstdiomisc.c: Make local functions static. * stdio-common/tst-printf.c: Likewise. * elf/constload2.c: Add prototype declarations to shut up gcc. * elf/dep1.c: Likewise. * elf/dep2.c: Likewise. * elf/dep3.c: Likewise. * elf/dep4.c: Likewise. * elf/ltglobmod2.c: Likewise. * libio/fmemopen.c: Make local functions static. * elf/Makefile (distribute): Added testobj.h. * elf/testobj.h: New file. * elf/testobj1.c: Include testobj.h and move prototype declarations to testobj.h. * elf/testobj2.c: Likewise. * elf/testobj3.c: Likewise. * elf/testobj4.c: Likewise. * elf/testobj5.c: Likewise. * elf/testobj6.c: Likewise. * elf/testobj1_1.c: Likewise. * elf/preloadtest.c: Likewise.
49 lines
674 B
C
49 lines
674 B
C
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
extern int bar (void);
|
|
extern int baz (void);
|
|
extern int foo (void);
|
|
|
|
void *h;
|
|
|
|
int
|
|
foo (void)
|
|
{
|
|
return 42 + bar ();
|
|
}
|
|
|
|
int
|
|
baz (void)
|
|
{
|
|
return -21;
|
|
}
|
|
|
|
void
|
|
__attribute__ ((__constructor__))
|
|
init (void)
|
|
{
|
|
h = dlopen ("constload3.so", RTLD_GLOBAL | RTLD_LAZY);
|
|
if (h == NULL)
|
|
{
|
|
puts ("failed to load constload3");
|
|
exit (1);
|
|
}
|
|
else
|
|
puts ("succeeded loading constload3");
|
|
}
|
|
|
|
static void
|
|
__attribute__ ((__destructor__))
|
|
fini (void)
|
|
{
|
|
if (dlclose (h) != 0)
|
|
{
|
|
puts ("failed to unload constload3");
|
|
exit (1);
|
|
}
|
|
else
|
|
puts ("succeeded unloading constload3");
|
|
}
|