Solved

Filtering out unused functions.

Posted on 2001-07-02
10
526 Views
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
thanks
Fleming
0
Comment
Question by:softfgk
10 Comments
 
LVL 32

Expert Comment

by:jhance
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
0
 

Author Comment

by:softfgk
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
0
 
LVL 3

Expert Comment

by:cypherljk
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...
0
 
LVL 32

Expert Comment

by:jhance
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.
0
 

Author Comment

by:softfgk
ID: 6246329
hah
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)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 32

Expert Comment

by:jhance
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.
0
 

Expert Comment

by:gilad_no
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.
0
 

Author Comment

by:softfgk
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
Fleming
0
 
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

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

Computer101
E-E Admin
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now