[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: library fuction calls

Dwivedi Ajay kumar wrote (ajayd@xxxxxxxxxx):

> 2. Compiled with gcc -shared -o malloc_interposer.so malloc_interposer.c
>    and then setting the LD_PRELOAD to the shared lib. Now "ls" gives the
>    problem:
>    <ajayd:tconn>/bin/ls
>    ls: error in loading shared libraries:
>     /home/ajayd/tconn/malloc_interposer.so: undefined symbol: dlsym
>    However it is working fine for echo
>    It is also working with vi,date etc.. but not ls

That's news, _nothing_except_ echo worked on my linux box. I could not run
anything if I compiled the the library as you have mentioned. Are you sure
youre not missing something?

> 	Any ideas ?

Yes, you need to include libdl in linux (RTFineM, sorry); add -ldl to your gcc
flags. As you see, Solaris and linux are not the friendliest when it comes to
linking in libraries and I've been bitten by this many times too.

- Raja