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
externsignatures in Rust FFI code match the corresponding C/C++ declarations.
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:
C/C++ analysis: Follow the Source Code Analysis Setup Guide for C and C++ to set up analysis for the C/C++ portion of your project.
C# analysis (if applicable): Follow the Source Code Analysis Setup Guide for C#/.NET to set up analysis for the C# portion of your project.
Rust analysis (if applicable): Follow the Source Code Analysis Setup Guide for Rust to set up analysis for the Rust portion of 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 a valid output:
For C/C++, verify that the project builds using the Axivion compiler without errors.
For C#, verify that the
.cspkgpackage file is generated without errors.For Rust, verify that the Rust RFG is produced 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.
Note
If you are planning cross-language architecture analysis, you will need to configure the “combined base view” and “combined hierarchy view” to match your architecture model.
Additional cross-language options can be configured in Architecture-Dependencies/cross_language_options.
Step 3: Enable Cross-Language Rules
Once the combined RFG is available, 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:
C#-CheckPInvoke: Check whether names and signatures of P/Invoke declarations match their native counterparts.
Architecture-CSharpCOMAnalysis: Analyze COM usages in C# code and add dependencies in the RFG.
For C/C++ + Rust projects:
Rust-CheckExternSignatures: Check whether names and signatures of extern declarations match their exported counterparts.
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:
C/C++ Setup Guide: Source Code Analysis Setup Guide for C and C++
C# Setup Guide: Source Code Analysis Setup Guide for C#/.NET
Rust Setup Guide: Source Code Analysis Setup Guide for Rust
C# Tool Reference: Source Code Analysis for C#/.NET
Rust Tool Reference: Source Code Analysis for Rust
Analysis Configuration Reference: Analysis Configuration Reference
Architecture Analysis User Guide: Architecture Analysis