Identifying unused procedures

I have a single app, no dlls. I have procedures that i’m sure are not being called but don’t know what they are. Is there a utility in the IDE, or other process, I can used to identify procedures that are not used/called? Looking to do some clean-up.


  • Andy

See this earlier post:

Apart from those tools you could manually search for each procedure name in your generated code using your favourite grep type tool. Some Clarion folk use KSS.

Or alternatively write some code to process your exported txa or generated clw files. Should not be too hard using something like StringTheory.


You try searching “wdnu” in the help. It’s not all that awesome, but can help.

1 Like

The compiler and linker do remove unused code and data.

Build your app in the debug mode and run it under the CW debugger. All source lines of unused procedures will have black text color.


Rename procedures you question to xProcedureName.

If the compiler doesn’t complain, ProcedureName isn’t being called.


Not necessarily going to work Jane. The templates will just use the new name.
Will work for hand code however.

1 Like

I use this regex to search for calls to a procedure in the generated CLW files. It isn’t perfect, there are some false positives, but it is pretty good.

^[^!']* *[ =+/^(~-](YourProcedureName) *([(,+^-]|$)(?:(?!DLL\(dll_mode\))[^\n\v\f\r])*$

Hi Rick -

With what tool do you use that? KSS?


Functions can be not used in a DLL but can be exported from it…
Functions can be assigned to reference variables of procedural types…
Functions can be used as parameters of ADDRESS.
Functions can be used as callbacks…

Clarion allows to have variables and functions with the same name in one scope.
Functions names can be overloaded. If there are 100 functions with the same name, 99 of hem can be used in the EXE/DLL but 100th one - not used.

Hey, Folks. Thank you for all the feedback/guidance. I’ve resolved it - kind of brute force - with a combination of findstr /S “searchTerm” replacing searchterm with the procedure name. If it showed up as name only, then not defined but not called. If it was called, I went back to the app and updated the calling procedure (Call tab) with the procedure in question. Not the most time efficient method, but it got the job done and it all compiled. The/a lesson is to put everything in its place.

Thanks again. You’re a great community.

1 Like


1 Like

Cool. I really like their PowerGrep product.

1 Like

Yeah. Didn’t think of that, Sean. I don’t call procedures from templates much except with NetTalk.

I posted what I did because I happened to spend yesterday giving a little love to a 15 year-old app that still used Shawn Mason’s prop:sql procedures. Part of my updating the app was replacing those procedures with a SQL class I wrote some years back.
So in that case, renaming Shawn’s procedures and then chasing the compile errors worked just fine.


The Smart Linker removes Unused Procedures. The way you can tell this happend is the ProcedureName@F is not in the ExeName.MAP file in the Map/Debug or /Release folder.

E.g. below is part of the MAP in Code in School.CLW


SelectStudents in the Code MAP above is highlighted below in the Linker built Map\Debug\School.MAP. Note the Name is “mangled” which for Clarion procedures adds an “@F” plus more if there are parameters … unless it has NAME(), YMMV.


If the SelectStudents Procedure was Not called you will NOT find it in the .MAP file. Its a Smart Linker because if that Browse was the only caller of Update Students then that would also be removed. In this case they are called so do appear.

I wrote the below App Splitter tool that reads the CLW MAP and the MAP file and EXP and shows some comparisons. I think on the “Procedures” tab if it shows the Map Size as Blank or Zero that means its not in the Map. I have not run it for a long time so do not recall.

One other .MAP file trick is it lists all the Imports. So if you wonder what APPs call a certain DLL Exported procedure you can search the .MAP files for it.

Below is part of the MAP for the DLL Tutor example showing the Imports: section. This shows it imports from the AllFiles.DLL the Global Request / Response.


Down lower you see it imports from Updates.DLL it imports ViewCustomers and other View procedures.


So if you wonder who is calling the ViewCustomer procedure search the MAP files for ViewCustomer@F … The @F is optional, but sometimes helpful, and may not always be there,

It’s need to remember that mangling of functions’ names depends from presence/absence of the C and PASCAL attributes. Also, the external name listed in the MAP file can be set explicitly using the NAME attribute.


Thanks! I never noticed that Black / Blue thing! The coloring is kind of subtle. Is there a place to configure the colors?

Example that .Append passing a (String) is called so Blue, but passing the (UltimateString) Class is not called so Black.


It not just Unused Procedure lines that are Black, its any lines that are not "executable code " e.g. comments and some data declarations (e.g. Auto and Equates). Maybe its lines that cannot have a Debug Breakpoint set, like if there is a continuation line that will be black because the Breakpoint must be set on the first line. The Key tip is if the Color of the Procedure line is Black it is Not called so Not used.


This example is interesting that it is Include(‘’) code which is a Class that is being “Smart Linked”. You only get the Methods you called in the EXE. If the Class is Exported from a DLL then you will get all of it because the Linker cannot know what external usage will call.

1 Like

The blue text color in the source window means that there is some association in the debug info between this line and some code in the executable. The black text color means that the debug info contains no association for this line and any code. NB: in most cases only first line of the multi-line statement is being colored blue.

In the shipping debugger - no. I have plans to add some features to my variant of the debugger. Choosing colors is one of them.

1 Like

i think i might still have a copy of app-ref , let me look