• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 542
  • Last Modified:

Filtering out unused functions.

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
softfgk
Asked:
softfgk
1 Solution
 
jhanceCommented:
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
 
softfgkAuthor Commented:
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
 
cypherljkCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jhanceCommented:
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
 
softfgkAuthor Commented:
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
 
jhanceCommented:
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
 
gilad_noCommented:
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
 
softfgkAuthor Commented:
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
 
Roshan DavisCommented:
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
 
Computer101Commented:
PAQed, with points refunded (100)

Computer101
E-E Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now