Skip to main content

export_fmu

Macro export_fmu 

Source
macro_rules! export_fmu {
    ($ty:ty) => { ... };
}
Expand description

Main macro for exporting an FMI 3.0 model as a shared library.

This macro generates all the required C API functions for an FMI 3.0 Functional Mockup Unit (FMU). It creates the complete interface required by an FMU importer.

§Parameters

  • $ty: The model type that implements the Model trait

§Requirements

The model type $ty must implement:

  • Model trait: Provides model metadata and core simulation functionality
  • Default: For creating initial model instances
  • UserModel: For user-defined model behavior

§Static Exports

The macro also exports static symbols that can be extracted from the compiled library:

  • FMI3_MODEL_VARIABLES: XML description of model variables
  • FMI3_MODEL_STRUCTURE: XML description of model structure
  • FMI3_INSTANTIATION_TOKEN: Unique token for model validation

§Safety

All generated functions include appropriate safety checks:

  • Null pointer validation for instance parameters
  • Array bounds checking for multi-value operations
  • Proper error handling and status reporting
  • Safe conversion between C and Rust data types