Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:23:53+00:00 2026-05-30T23:23:53+00:00

How can I extract just the required functions from a pile of C source

  • 0

How can I extract just the required functions from a pile of C source files? Is there a tool which can be used on GNU/Linux?

Preferably FOSS, but the GNU/Linux is a hard requirement.

Basically I got about 10 .h files; I’d like to grab part of the code and get the required variables from the header files. Then I can make a single small .h file corresponding to the code I’m using in another project.

My terms might not be 100% correct.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:23:55+00:00Added an answer on May 30, 2026 at 11:23 pm

    One tool that you may or may not be aware of is cscope. It can be used to help you.

    For a given set of files (more on what that means shortly), it gives you these options:

    Find this C symbol:
    Find this global definition:
    Find functions called by this function:
    Find functions calling this function:
    Find this text string:
    Change this text string:
    Find this egrep pattern:
    Find this file:
    Find files #including this file:
    

    Thus, if you know you want to use a function humungous_frogmondifier(), you can find where it is declared or defined by typing its name (or pasting its name) after ‘Find this global definition’. If you then want to know what functions it calls, you use the next line. Once you’ve hit return after specifying the name, you will be given a list of the relevant lines in the source files above this menu on the screen. You can page through the list (if there are more entries than will fit on the screen), and at any time select one of the shown entries by number or letter, in which case cscope launches your editor on the file.

    How about that list of files? If you run cscope in a directory without any setup, it will scan the source files in the directory and build its cross-reference. However, if you prefer, you can set up a list of files names in cscope.files and it will analyze those files instead. You can also include -I /path/to/directory on the cscope command line and it will find referenced headers in those directories too.

    I’m using cscope 15.7a on some sizeable projects – depending on which version of the project, between about 21,000 and 25,000 files (and some smaller ones with only 10-15 thousand files). It takes about half an hour to set up this project (so I carefully rebuild the indexes once per night, and use the files for the day, accepting that they are a little less accurate at the end of the day). It allows me to track down unused stuff, and find out where stuff is used, and so on.

    If you’re used to an IDE, it will be primitive. If you’re used to curses-mode programs (vim, etc), then it is tolerably friendly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some path c:\server\folderName1\another name\something\another folder\ . How i can extract from there
We can extract the mimetype from byte array, e.g., by using Apache Tika. Is
How can I extract 456 from xxx_456 where xxx is of indefinite length?
How can i extract title,header of a web page directly from the internet??
How can I extract the groups from this regex from a file object (data.txt)?
Tcpflow outputs a bunch of files, many of which are HTTP responses from a
gcc 4.4.3 c89 I have the following string sip:12387654345443222118765@xxx.xxx.xxx.xxx How can I extract just
Is there anything holding me back from just doing the whole membership, roles, and
I'm looking to extract pitches from a sound signal. Someone on IRC just explained
If I have a DateTime field within a table. How can I extract just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.