library- functions

O

onkar

I have compiled the code with lots of libraries (some of which might
not be required in the code at all !) I want to know which function
is in which library . How do I get info about the function (i.e., it
belong to which library ) from the exe of my compiled code ?
 
K

Keith Thompson

Daniel Molina Wegener said:
onkar <[email protected]>


Try ldd(1) to verify which libraries are linked against your
executable or library, then you can remove unused libraries
from the compiling command.

Also, objdump(1) may help on which functions are used in your
project.

Attempting to answer system-specific questions like this is a bad
idea, as you've just demonstrated. The original poster referred to
"the exe", which probably means a file with a ".exe" suffix, implying
that he's probably using MS Windows (or VMS, but that's unlikely these
days).

ldd and objdump are specific to Unix-like systems.

The OP needs to post his question to a forum that deals with whatever
system he's using, most likely comp.os.ms-windows.programmer.win32.
 
A

Antoninus Twink

Attempting to answer system-specific questions like this is a bad
idea, as you've just demonstrated. The original poster referred to
"the exe", which probably means a file with a ".exe" suffix, implying
that he's probably using MS Windows (or VMS, but that's unlikely these
days).

Of course, this is nonsense. There are certainly Windows equivalents for
ldd and objdump, and there are plenty of Windows experts here to tell us
what they are.

For example, a similar question was discussed a couple months ago, and
Jacob Navia dealt with this in a Windows setting:
<http://groups.google.com/group/comp.lang.c/browse_thread/thread/5d13383861d93fff/00671242bfd70c4a>

Obviously lcc-win32 comes with tools that will do what the OP wants, if
indeed he's using Windows. ("The exe" might just be a shortcut for "the
executable", after all.)
 
K

Keith Thompson

Malcolm McLean said:
Unless you have access to a tool already written for the purpose, it
is very difficult. Compilers typically strip most of the symbols from
final executables. However the functions remain as machine code, so if
you know what they look like you can retrieve them. Also some symbols
may remain either to help debuggers along, or to aid linking with
system libraries at run time.

The first port of call is to dump the executable as hex/ASCII and see
if you can make any sense of it.

I'd say that dumping the executable in hex and/or ASCII should be a
last resort. The first resort should be finding a pre-existing tool
on the system you're using that will do the job for you.

Finding such a tool is left as an exercise for another newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top