LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 05-27-2009, 05:13 AM   #1
Pramoda.M.A
LQ Newbie
 
Registered: Mar 2009
Location: Bangalore
Posts: 11

Rep: Reputation: 0
Question 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.
 
Old 05-27-2009, 05:20 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.
 
Old 05-28-2009, 01:50 AM   #3
Pramoda.M.A
LQ Newbie
 
Registered: Mar 2009
Location: Bangalore
Posts: 11

Original Poster
Rep: Reputation: 0
It is not working...
 
Old 05-28-2009, 01:55 AM   #4
nilathinesh
Member
 
Registered: Nov 2006
Distribution: Fedora 7 & 9, Ubuntu
Posts: 41

Rep: Reputation: 15
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.

Last edited by nilathinesh; 05-28-2009 at 02:09 AM.
 
Old 05-28-2009, 03:05 AM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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

Last edited by chrism01; 05-28-2009 at 03:14 AM. Reason: added man page ptrs
 
Old 05-28-2009, 07:01 AM   #6
nilathinesh
Member
 
Registered: Nov 2006
Distribution: Fedora 7 & 9, Ubuntu
Posts: 41

Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
echo "blabla" in a script present present in /etc/rc.d/rc5.d/S96dinesh murugesan Linux - Newbie 3 04-14-2009 11:53 PM
ndiswrapper shows 'driver present, hardware present' but no wlan0 0x12d3 Linux - Wireless Networking 2 05-11-2007 08:43 PM
Ubuntu: driver present, hardware present, now what! Nathan1993 Linux - Wireless Networking 2 03-12-2006 07:19 PM
Need a Definition dudeman41465 Linux - Software 2 11-07-2005 06:07 AM
ndiswrapper - driver present:harware present but no connection esteeven Linux - Wireless Networking 2 12-26-2004 05:06 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration