C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-18-2005, 06:52 AM   #1
Registered User
 
Join Date: Aug 2005
Posts: 3
Accessing function list

Hello everybody

is there a way to access the function list of a program from within the program itself? I have a list of function pointers (in a C program) to assign dinamically on rutime. Can this be done? Where I can look for further info on the matter?

Thanks in advance!

Fabio.

Last edited by SnowDruid; 08-18-2005 at 06:54 AM.
SnowDruid is offline   Reply With Quote
Old 08-18-2005, 08:31 AM   #2
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,890
http://www.newty.de/fpt/index.html

gg
Codeplug is offline   Reply With Quote
Old 08-19-2005, 12:24 PM   #3
Registered User
 
Join Date: Aug 2005
Posts: 3
thanks!
SnowDruid is offline   Reply With Quote
Old 08-27-2005, 06:13 AM   #4
Registered User
 
Join Date: Aug 2005
Posts: 3
errr... that was essay on function pointers. Nothing (even in the links section). Maybe I didn't made myswlf clear: I want to know which functions my executable incorporates, (I imagine) doing a little memory tinkering on the memory space of the program.

I want something like:

./a.out
This program has a function called main() at 0x4214141
This program has a function called add_this() at 0x421405A
This program has a function called sub_this() at 0x42146FB
...

Is this possible? is there any help libraries to do something like this?

Thanks again
Fabio.
SnowDruid is offline   Reply With Quote
Old 08-28-2005, 01:28 PM   #5
Registered User
 
Join Date: Aug 2005
Posts: 5
have u tried strace? It works for system calls ...
pavmarc is offline   Reply With Quote
Old 08-28-2005, 01:33 PM   #6
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,630
Sounds about the same as this question.
going to a another function

Some things you can consider
- Read the manual page for dlsym
- study the output of the 'nm' command.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 08-30-2005, 10:17 AM   #7
.
 
Join Date: Nov 2003
Posts: 293
I think he wants to list the addresses of functions declared in the executable.
There is no way to do that inside ciode without knowing the names of all of the function entry points. But you get this from "outside" the executable using nm.

You will have to maintain an internal table (array) of function pointers that is specific to your code.

Or download a copy of the linux nm source for your architecture, and see how nm indentifies function entry points. You would then have to scan the executable at runtime to build an internal table, because every time you re-link it is possible for entrypoint addresses to change.
jim mcnamara is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort a simple linked list using swap-sort method JOCAAN C Programming 24 08-07-2009 11:48 AM
Dikumud maxorator C++ Programming 1 10-01-2005 06:39 AM
Interface Question smog890 C Programming 11 06-03-2002 05:06 PM
List class SilasP C++ Programming 0 02-10-2002 05:20 PM
singly linked list clarinetster C Programming 2 08-26-2001 10:21 PM


All times are GMT -6. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22