9.12.2 Practice and Experience

Your code will probably rely on operator declarations and possibly term expansion. The cross-referencer handles this in the following way: you must supply an initialization file, using the -i ifile option. spxref will execute any operator declaration it encounters.

Supply meta-predicate declarations for your meta-predicates. Otherwise, the cross-referencer will not follow the meta-predicates' arguments. Be sure the cross-referencer encounters the meta-predicate declarations before it encounters calls to the declared predicates.

The cross-referencer traces from initializations, hooks, predicates declared public, and optionally from user:runtime_entry/1 and module declarations. The way it handles meta-predicates requires that your application load its module-files before its non-module-files.

This cross-referencer was written in order to tear out the copious dead code from the application that the author became responsible for. If you are doing such a thing, the cross-referencer is an invaluable tool. Be sure to save the output from the first run that you get from the cross referencer: this is very useful resource to help you find things that you've accidentally ripped out and that you really needed after all.

There are situations where the cross-referencer does not follow certain predicates. This can happen if the predicate name is constructed on the fly, or if it is retrieved from the database. In this case, add public declarations for these. Alternatively, you could create term expansions that are peculiar to the cross-referencer.


Send feedback on this subject.