LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   dlsym returning NULL (https://www.linuxquestions.org/questions/programming-9/dlsym-returning-null-141312/)

tim_l 02-02-2004 04:36 AM

dlsym returning NULL
 
Hi,

Am trying to resolve the address of a function using dlsym, but for reasons beyond me every call to dlsym to resolve either fstat or lstat or stat returns nil.

The strange thing is I can call these functions without any difficulty so it isn't a problem with files being included or anything like that.

Any ideas?

Cheers,

Tim

kev82 02-02-2004 08:13 AM

which file are you expecting to find the symbols stat and lstat in? if your trying to use the glibc ones then a quick look at the output of

objdump -t /lib/libc-2.2.5.so | awk '{print $6}' | grep stat$
(command may vary with different systems)

gives

fts_stat
svcraw_stat
svctcp_stat
rendezvous_stat
svcudp_stat
svcunix_stat
rendezvous_stat
_lxstat
_xstat
_IO_default_stat
_fxstat
ustat
__lxstat
_IO_file_stat
__xstat
__fxstat

shows there is no stat or lstat in glibc, i suggest you read the header file(/usr/include/sys/stat.h) to find out which symbol you want.

tim_l 02-02-2004 08:27 AM

I hadn't realised that the stat family of functions were in fact wrappers. Which is why the call was failing. Should have had a more detailed look through the stat.h header file.

Thanks for the help


All times are GMT -5. The time now is 07:07 AM.