how to get all invoked system API of a program

This is a discussion on how to get all invoked system API of a program within the C Programming forums, part of the General Programming Boards category; Hello everyone, Suppose we have the source codes, how to get all invoked system API (like printf, open, etc.) other ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    how to get all invoked system API of a program

    Hello everyone,


    Suppose we have the source codes, how to get all invoked system API (like printf, open, etc.) other than program self-defined API? Are there any existing tools?

    Either on Windows or on Linux platform is ok.


    thanks in advance,
    George

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    Try the nm command in linux:
    Code:
    itsme@itsme:~/C$ cat nmexample.c
    #include <stdio.h>
    #include <string.h>
    
    void foo(void) { }
    
    int main(void)
    {
      char buf[BUFSIZ];
    
      strcpy(buf, "Hello, world!");
      puts(buf);
      printf("%s\n", buf);
      foo();
    
      return 0;
    }
    Code:
    itsme@itsme:~/C$ nm -D nmexample
    080484f8 R _IO_stdin_used
             w _Jv_RegisterClasses
             w __gmon_start__
             U __libc_start_main
             U printf
             U puts
             U strcpy
    itsme@itsme:~/C$
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you itsme86!


    Quote Originally Posted by itsme86
    Try the nm command in linux:
    Code:
    itsme@itsme:~/C$ cat nmexample.c
    #include <stdio.h>
    #include <string.h>
    
    void foo(void) { }
    
    int main(void)
    {
      char buf[BUFSIZ];
    
      strcpy(buf, "Hello, world!");
      puts(buf);
      printf("%s\n", buf);
      foo();
    
      return 0;
    }
    Code:
    itsme@itsme:~/C$ nm -D nmexample
    080484f8 R _IO_stdin_used
             w _Jv_RegisterClasses
             w __gmon_start__
             U __libc_start_main
             U printf
             U puts
             U strcpy
    itsme@itsme:~/C$
    Your reply makes senses. I have tried to use nm to analyze an executable file on Linux platform, using the -D option and it works good. I have also looked at the man page of -D option of Linux man page. It is explained as dynamic symbol analysis rather than normal symbols. What does it mean -- dynamic symbols? normal symbols?


    regards,
    George

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    It means it lists symbols that aren't resolved in the executable. Symbols that are linked at runtime from a library file.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  2. system commands. deletion of file after program terminates
    By xddxogm3 in forum C++ Programming
    Replies: 12
    Last Post: 11-24-2003, 10:41 PM
  3. How do I put my program into the system tray?
    By kinghajj in forum Windows Programming
    Replies: 1
    Last Post: 11-05-2003, 07:56 PM
  4. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM

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