Filtering out unused functions.

Posted on 2001-07-02
Medium Priority
Last Modified: 2013-11-20
Hi All
I was wondering if there is an easy way to know whether a function in a project is used or not.
The reason for this is , I have a project devoleped over the years by so many programmers and have a lot of redundant functions in it which may be not used in the currect version.

I tried with profiler but it gives only information about the functions executed at runtime.

Any help is greatly appreciated
Question by:softfgk
LVL 32

Expert Comment

ID: 6246020
The VC++ linker automatically leaves unused functions out of the linked EXE or DLL.  If you want to see what is included, use the Visual Studio DEPENDS.EXE tool or the command line tool DUMPBIN /IMPORTS

Author Comment

ID: 6246189
well that will show which all functions have you imported into ur exe module.
thats not what i want.
I am looking for someway to findout unused functions within that EXE

Expert Comment

ID: 6246216
I don't know of quick way but how about getting a bump of all the function symbols and them doing a search/find on your code text to see where the functions are called. This is not a pretty solution and I'm going to try jhance's to see if it works

My 2 cents...
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 32

Expert Comment

ID: 6246286
PLEASE EXPLAIN!  You said a profiler didn't do what you want because it only works at run time.  That is true.

The DEPENDS shows you which functions are included in the EXE file.  Unless you do something stupid in your linker setup, it will NOT include any unreferenced functions in your EXE after it links your program.

Author Comment

ID: 6246329
dont u get it ?
>The DEPENDS shows you which functions are included in the >EXE file
thats true . but only functions which you have imported from other modules.

Here i am trying to clean up the goddamn code by getting rid of the functions in the EXE which are never called(even if it is not included in the final EXE by the linker)
LVL 32

Expert Comment

ID: 6247061
I'm sorry but I cannot be of any further help.  Clearly, you know much more than I do here.....

Good luck with your project.

Expert Comment

ID: 6247556
You can use the Source Browser. It can show you every call to the function in your project. If you don't see any call to it, you can safely remove the function from your project. I used it on my project and it works fine.

Author Comment

ID: 6249575
Hi guys
the tool Understanding for c++(from scitools.com) really did what i wanted
Initially i was going for rational pure coverage and numega true coverage. But both gives runtime analysis only like profiler which comes with VC++ itself.

thanks all for ur suggestions
LVL 23

Expert Comment

by:Roshan Davis
ID: 9490230
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days.


Roshan Davis
EE Cleanup Volunteer

Accepted Solution

Computer101 earned 0 total points
ID: 9537255
PAQed, with points refunded (100)

E-E Admin

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question