This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Different exported symbols in libc.a and libc.so
- To: Paul Eggert <eggert at twinsun dot com>
- Subject: Re: Different exported symbols in libc.a and libc.so
- From: Constantin Loizides <Constantin dot Loizides at isg dot de>
- Date: Tue, 16 Oct 2001 18:23:25 +0200
- Cc: libc-alpha at sources dot redhat dot com, Bug-glibc at gnu dot org
- Organization: Innovative Software AG
- References: <3BC2C6EE.DE495333@isg.de> <200110150414.f9F4Era04053@sic.twinsun.com>
Hi,
> You shouldn't rely on the chdir/__chdir relationship when you're
> trying to write a chdir wrapper. Instead, you should simply wrap
> chdir, without worrying about __chdir.
>
> With dynamic shared objects, you should be able to do this with dlsym
> and RTLD_NEXT.
>
> This stuff isn't in the glibc 2.2.4 documentation, so it's no wonder
> you're not familiar with it. But you have the source.
Thanx for your tip! I managed to understand how to use
dlsym with RTLD_NEXT to wrap simple calls.
But now suppose that I also want to catch calls from inside
the glibc :
eg. I define my own open which makes use of the glibc open
via the dlsym and RTLD_NEXT, then my application
uses fopen. This fopen I will not catch as it uses
__open with is a weak symbol of __libc_open.
How do you suggest to catch that without relaying on it!
Up to now I do:
int __open (const char *file,int oflag,...) __attribute__ ((alias
("myopen")));
Constantin