[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

library- functions

onkar

8/16/2008 8:26:00 AM

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 ?
6 Answers

William Pursell

8/16/2008 8:34:00 AM

0

On 16 Aug, 09:25, onkar <onkar....@gmail.com> wrote:
> 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 ?

How did you build the executable? You could omit
libraries from the link line (don't specify -lfoo) and
see which functions the linker complains about. You
might use the various tools for examining the contents of
the library (eg objdump).

Your best bet is to ask the question in a more appropriate
newsgroup.

Daniel Molina Wegener

8/16/2008 11:50:00 AM

0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

onkar <onkar.n.m@gmail.com>
on Saturday 16 August 2008 04:25
wrote in comp.lang.c:

> 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 ?

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.

Regards,
- --
.O. | Daniel Molina Wegener | C/C++ Developer
..O | dmw [at] coder [dot] cl | FOSS Coding Adict
OOO | http:/... | Standards Rocks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iEYEARECAAYFAkimvu4ACgkQxyPEFPXO3WFjBACgitwYb6o+qh6RE2ZGZr8QBfGr
BVAAnjP6Y/aWAkusebOaVfCEJia14xar
=+gO3
-----END PGP SIGNATURE-----

Keith Thompson

8/16/2008 5:44:00 PM

0

Daniel Molina Wegener <dmwREMOVEUPPERCASE@coder.cl> writes:
> onkar <onkar.n.m@gmail.com>
> on Saturday 16 August 2008 04:25
> wrote in comp.lang.c:
>> 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 ?
>
> 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.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

John B. Matthews

8/16/2008 5:59:00 PM

0

On 16 Aug 2008 at 17:44, Keith Thompson wrote:
> Daniel Molina Wegener <dmwREMOVEUPPERCASE@coder.cl> writes:
>> 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).

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/00671242bf...

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.)

Malcolm McLean

8/16/2008 9:09:00 PM

0


"onkar" <onkar.n.m@gmail.com> wrote in message news:
>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 ?
>
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.

--
Free games and programming goodies.
http://www.personal.leeds.ac....

Keith Thompson

8/17/2008 1:30:00 AM

0

"Malcolm McLean" <regniztar@btinternet.com> writes:
> "onkar" <onkar.n.m@gmail.com> wrote in message news:
>>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 ?
>>
> 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.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"