Analyze a mixed / multi-language project¶
Most real code bases use more than one language — new Java on top of a C++ library, Ada calling C and FORTRAN, a web front end over a C# service. Understand's Combined Language Analysis parses all of it into one database and follows the jumps between languages, so calls, uses, dependencies, and metrics span the whole system instead of stopping at each language boundary.
The source is parsed once, not once per language, and after analysis Understand shows the dependence between parts of the code written in different languages — dependencies you can browse, export, and enforce rules against like any other.
Turn it on: just select the languages¶
There is no separate "combined" mode — a project is multi-language whenever you enable more than one language.
- New Project wizard: on the Languages page, check every language your code uses.
- CLI: pass them all to
-languageswhen you create the project:
und -db project.und create -languages c++ java ada
und -db project.und add @sources.txt
und -db project.und analyze -all
Add each language's own settings after that — see the per-language accuracy notes. Each language keeps its own configuration (classpaths for Java, includes/macros for C/C++, format for Fortran, and so on); they don't interfere.
How cross-language links are resolved¶
Understand connects entities across languages through their externally linkable names. Each language's options include Multiple Language Linkage settings that control this matching, for example:
- The case of externally linkable entities (lowercase, uppercase, or preserved).
- A prefix/suffix applied to external names (Java's JNI/KNI prepend defaults to
Java_; Fortran and JOVIAL offer prepend/append text).
When a call from one language to another doesn't link up, these linkage options are the first thing to check: the exported name on one side must match the imported name Understand computes on the other.
Accuracy still comes from per-language configuration¶
Combining languages does not lower the bar for any one of them. A mixed project is only as accurate as its least-configured language:
- Missing a Java classpath leaves Java library types undefined even if C++ is perfectly configured.
- Missing C/C++ includes/macros leaves inactive code regardless of the other languages.
Configure each language as you would on its own (per-language notes; accurate C/C++ projects), then analyze once.
Caveats¶
- Choose languages up front. Enabling a language a project wasn't created with means re-analyzing so the new sources are parsed.
- Cross-language calls only link when names match. If a language is only reachable through a name form Understand can't reconstruct (heavy runtime reflection, generated stubs), those edges won't appear — tune the linkage options above.
- Performance scales with total source, since everything lives in one database; see performance on large codebases if analysis is slow.
See it in action
The bundled ZLib example project (Help → Open Example Project) mixes C, C++, C#, Assembly, Ada, Delphi, and Pascal in one database — a good reference for what combined analysis looks like.
For a task-oriented walkthrough of working with a mixed code base, see Mixed-language codebases.