Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Filtering out unused functions.

Posted on 2001-07-02
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Looking for a specific application/software 2 114
fizzArray2 challenge 1 90
pre4 challenge 19 103
Execute multiple curl cmds with sleep and send output to file 10 104
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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