![]() |
| | #1 |
| Registered User Join Date: Aug 2005
Posts: 3
| Accessing function list 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 | |
| | #2 |
| Registered User Join Date: Mar 2003
Posts: 3,890
| |
| Codeplug is offline | |
| | #3 |
| Registered User Join Date: Aug 2005
Posts: 3
| thanks! |
| SnowDruid is offline | |
| | #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 | |
| | #5 |
| Registered User Join Date: Aug 2005
Posts: 5
| have u tried strace? It works for system calls ... |
| pavmarc is offline | |
| | #6 |
| and the hat of Jobseeking 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. |
| Salem is offline | |
| | #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 | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |