3.5. Cross-Language Analysis Setup Guide

This guide provides step-by-step instructions for setting up Axivion analysis that spans multiple programming languages. It assumes that you already have a working Axivion Suite installation and have configured an instance of the Axivion Dashboard Server.

3.5.1. Overview

The Axivion Suite supports combined analysis of projects that mix C/C++ with either C# or Rust. This enables:

  • A unified dashboard containing all source code and analysis results.

  • Combined architecture analysis across language boundaries.

  • Detection of cross-language interface problems when using mechanisms such as P/Invoke, COM, or Rust’s FFI.

Supported language combinations are:

  • C/C++ + C#: enables the C#-CheckPInvoke rule, which verifies P/Invoke and COM call sites between C# managed code and C/C++ native code.

  • C/C++ + Rust: enables the Rust-CheckExternSignatures rule, which verifies that extern signatures in Rust FFI code match the corresponding C/C++ declarations.

These two rules compare C# or Rust declarations with the routines exported by the C/C++ IR. They require /Project/ir to be set, but do not require a combined RFG.

Other rules – such as cycle detection, dead code detection, and architecture analysis – can also operate across both language portions once a combined RFG is available.

3.5.2. Prerequisites

Before configuring a cross-language analysis, you need a working single-language analysis for each language involved in your project:

Ensure that each individual analysis runs successfully before attempting a combined cross-language analysis.

3.5.3. Initial Setup

Step 1: Set Up Each Language Analysis

Refer to the language-specific setup guides listed under Prerequisites above, and verify that each analysis runs successfully and produces valid output:

  • For C/C++, verify that the project builds using the Axivion compiler without errors.

  • For C#, verify that the .cspkg package file is generated without errors.

  • For Rust, verify that AxivionRustFrontend runs without errors.

Step 2: Configure a Combined Analysis

When both a C/C++ IR and either a C# or Rust input are available in the same analysis, the Architecture-Dependencies step will automatically produce a combined RFG.

By default, the combined RFG will include all views from the individual language portions, along with the following combined views:

  • Call: Combined C/C++ and C# or Rust Call view (e.g., for combined cycle detection).

  • Entries: Combined C/C++ and C# or Rust Entries view (e.g., for combined dead code analysis).

  • Code Facts: Combined C/C++ and C# or Rust Code Facts view, used as the base view for architecture analysis.

  • Hierarchy: Combined C/C++ Module and C# or Rust Code Facts view, used as the hierarchy view for architecture analysis.

For C# P/Invoke, the combined views contain cross-language dependencies between managed imports and native exports. If corresponding parameter types are composite, the managed and native types are additionally connected by a Native_Type_Of dependency directed from the managed type to the native type. This edge is a subtype of Use_Of_Type, so it can be considered by architecture analysis.

Note

If you are planning cross-language architecture analysis, you will need to set base_view_name to the combined Code Facts view and hierarchy_view_name to the combined Hierarchy view, or to the views that match your architecture model.

Additional cross-language options can be configured in Architecture-Dependencies/cross_language_options.

Step 3: Enable Cross-Language Rules

Once both inputs are included in the same analysis, you can enable rules that operate across language boundaries. Navigate to the Analysis configuration in axivion_config and enable the relevant rules for your language combination:

For C/C++ + C# projects:

For C/C++ + Rust projects:

For all cross-language combinations:

  • Cycle detection, dead code detection, architecture verification, and metrics rules are all available across the combined RFG once configured.

3.5.4. Where To Go From Here

Once you have a working cross-language analysis, you can further customize it:

  • For architecture verification, follow the instructions in the architecture guide.

  • For dead code detection, follow the instructions in the dead code guide.

  • For metrics configuration, see Metrics.

  • For an in-depth walkthrough of architecture analyses, see Architecture Analysis.

3.5.5. References

For more detailed information, refer to these resources: