LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to know definition is present or not? (https://www.linuxquestions.org/questions/linux-software-2/how-to-know-definition-is-present-or-not-728790/)

Pramoda.M.A 05-27-2009 04:13 AM

How to know definition is present or not?
 
Hi All,

Say, i have librayr file or shared object file. I need to know, required function's definition is present in the .a file/.so file. Is it possible?
If possible, how to?
It is like, GetProcAddress() in Windows.
Please anybody help me.

colucix 05-27-2009 04:20 AM

You can use
Code:

grep -w function_name file.so
It will not show you the matching lines (since they are binary files) but it will tell you if it matches.

Pramoda.M.A 05-28-2009 12:50 AM

It is not working...

nilathinesh 05-28-2009 12:55 AM

Quote:

if the .so is for intel processor then..

try

nm file.so |grep function_name

otherwise use the appropriate compiler-nm and try
it is wrong answer, i mis-recognized as ".o" file.. and post the correct answer if i am getting.

chrism01 05-28-2009 02:05 AM

To check if a library is called by a program
Code:

ldd program | grep libname
check if specific fn or file is used in program (or lib file)
Code:

strings program |  grep <fn_name>
Also

man readelf
man od

nilathinesh 05-28-2009 06:01 AM

i got the answer for my other question posted here in

software-kernel

http://www.linuxquestions.org/questi...number-726180/

i tried

Code:

strings bridgedriver.ko |grep vermagic
this returned me the version of the kernel using which the ko is built..

Thanks chrism01


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