view the symbol inside the .so or .o file
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > view the symbol inside the .so or .o file




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    view the symbol inside the .so or .o file  
vp


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:21 PM

This question is simple, I think, although I searched google and got
no hints ( I must have chosen the in-appropriate keywords ).

I am looking for a tool that can help me to see the symbols ( function
names ) inside a .so or .o file.

My real problem is when linking with command like

# g++ -o myapp.o file1.o file2.o file3.o -lmylib -L. -R.

with -lmylib is for a libmylib.so containing some common functions
cmf1(), cmf2() ... to which all file1.cpp, file2.cpp and file3.cpp
call.

I get the error :

Undefined                       first referenced
symbol                             in file
cmf1                                file2.o
cmf2                                file2.o

What I don't understand here is why it applies to *only* f2. I  define
the

#ifdef __cplusplus
extern "C" {
#endif

and
#ifdef __cplusplus
}

for those common functions cmf1() and cmf2().

Thanks for your help,

DT

[ It did work at around 2AM. Maybe I need some sleep :-) ]





[ Post a follow-up to this message ]



    Re: view the symbol inside the .so or .o file  
Jerry Feldman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:21 PM

On 28 Dec 2003 07:25:16 -0800
dt1649651@yahoo.com (vp) wrote:
quote:
> This question is simple, I think, although I searched google and got > no hints ( I must have chosen the in-appropriate keywords ). > > I am looking for a tool that can help me to see the symbols ( function > names ) inside a .so or .o file.
nm(3) is the command you need. There are many options, such as whether or not to demangle a symbol. (C++ symbols are mangled). -- Jerry Feldman <gaf-nospam-at-blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9




[ Post a follow-up to this message ]



    Re: view the symbol inside the .so or .o file  
Jens.Toerring@physik.fu-berlin.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:21 PM

vp <dt1649651@yahoo.com> wrote:
quote:
> This question is simple, I think, although I searched google and got > no hints ( I must have chosen the in-appropriate keywords ).
quote:
> I am looking for a tool that can help me to see the symbols ( function > names ) inside a .so or .o file.
quote:
> My real problem is when linking with command like
quote:
> # g++ -o myapp.o file1.o file2.o file3.o -lmylib -L. -R.
quote:
> with -lmylib is for a libmylib.so containing some common functions > cmf1(), cmf2() ... to which all file1.cpp, file2.cpp and file3.cpp > call.
Someone else already told you about nm(1) which lets you see the symbols in an .o or .so file. But there might already be something broken with your command line: you may need the "-L." *before* the "-lmylib" in case libmylib.so is in the current directory. Regards, Jens -- \ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de \__________________________ http://www.physik.fu-berlin.de/~toerring




[ Post a follow-up to this message ]



    Re: view the symbol inside the .so or .o file  
vp


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:21 PM

Thanks, Jerry and Jens, for your help.

Yes, it is the "nm" that i was looking for.

I found the problem , although it is a little weird : I must have
mistyped some commands and there are some extra empty .c files with
the same name with the .cpp files. After deleting these extra .c files
and running make clean / make all, those errors disappeared.

I found these .c file names when using the nm.

Thanks again.

DT
PS: it's fun to mention that I could not find that error until
deciding to take a break by watching "The Italian job", and I do like
Lyle, the Napster computer guy :-)





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:30 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register