LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 04: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, 04:20 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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, 12: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, 12: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 01:09 AM.
 
Old 05-28-2009, 02:05 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,231

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
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 02:14 AM. Reason: added man page ptrs
 
Old 05-28-2009, 06: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 10:53 PM
ndiswrapper shows 'driver present, hardware present' but no wlan0 0x12d3 Linux - Wireless Networking 2 05-11-2007 07:43 PM
Ubuntu: driver present, hardware present, now what! Nathan1993 Linux - Wireless Networking 2 03-12-2006 06:19 PM
Need a Definition dudeman41465 Linux - Software 2 11-07-2005 05:07 AM
ndiswrapper - driver present:harware present but no connection esteeven Linux - Wireless Networking 2 12-26-2004 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:55 PM.

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
Open Source Consulting | Domain Registration