Add a new function to dlfcn.h?

Y.D. qcloud1014@gmail.com
Mon Aug 17 02:15:28 GMT 2020


Hi Florian,
Thanks for your quick reply!

Now I've created a new file called dl-usage.c under elf/. And I've added
dl-usage to routines in Makefile under elf/, just in case, I've added it to
dl-routines, too.
But when I create a new file, including dlfcn.h and refer to the function,
the error message is "undefined reference to `dlusage'  collect2: error: ld
returned 1 exit status".

I can make sure that:
I've declared the function in dlfcn/dlfcn.h and implemented it in
elf/dl-usage.c
There are dl-usage.o, dl-usage.os files under build/elf
I use the modified version of dynamic library by "-Wl, -rpath=" command

Can you tell me where the problem is?

Sorry I didn't cc the list last time.

Fengkai

Florian Weimer <fw@deneb.enyo.de> 于2020年8月16日周日 下午8:59写道:

> * Y. D. via Libc-help:
>
> > The question is, when I want to imitate the way dlopen works, I find that
> > the dlopen first calls functions in dlfcn/dlopen.c, and then functions in
> > elf/dl-open.c, which makes me very confused.
> > If I want to add a new function in dlfcn.h, what should I do?
>
> New dynamic linker functions should probably go into libc.so.6, and
> implemented under elf/.
>
> There is not much value in maintaining a separate libdl (but it's less
> problematic than libpthread).  I expect that libdl will eventually go
> away.
>


More information about the Libc-help mailing list