Re: finding function names in a static built app by text name?
Jens.Toerring_at_physik.fu-berlin.de
Date: 12/11/04
- Previous message: somelinuxguy: "finding function names in a static built app by text name?"
- In reply to: somelinuxguy: "finding function names in a static built app by text name?"
- Next in thread: Timur Aydin: "Re: finding function names in a static built app by text name?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 10 Dec 2004 23:58:25 GMT
somelinuxguy <averagegg@hotmail.com> wrote:
> I've been looking for a way to find the address of a function
> within my Linux app by using its text name and have had no luck.
> This is analogous to using dlsym() to find a symbol by name in a
> dynamically
> linked app but I need it to work in my static build app. (I would
> rather not
> read the output of 'nm' if I can avoid it.)
> For example:
> main()
> {
> int (*f)();
> f = FINDSYM("func_a");
> (*f)();
> ...
> }
> int func_a()
> {
> }
It's much simpler:
f = func_a;
is all you need and you have a pointer to that function. And then you
can call it simply with
f( );
without any dereferencing required (which you can do anyway, but
it's not necessary). That's not even Linux-specific but straight,
standard-compliant C.
Regards, Jens
-- \ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de \__________________________ http://www.toerring.de
- Previous message: somelinuxguy: "finding function names in a static built app by text name?"
- In reply to: somelinuxguy: "finding function names in a static built app by text name?"
- Next in thread: Timur Aydin: "Re: finding function names in a static built app by text name?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|