Dynamic memory allocation interface - Dynamically allocated array at generated function interface - MATLAB (original) (raw)

Main Content

Dynamically allocated array at generated function interface

Description

App Configuration Pane: Memory

Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

The Dynamic memory allocation interface parameter controls the implementation of dynamically allocated arrays at the interface of generated C++ functions. Select whether to implement dynamically allocated arrays by using:

When using the MATLAB® Coder™ app, by default, the code generator uses the Determine dynamic memory allocation interface based on language setting. If theLanguage parameter is C, this parameter is disabled and the code generator uses C-style emxArray data structures.

When using the GPU Coder™ app, by default, the code generator uses C-styleemxArray data structures.

Note

If you are using the GPU Coder app, if the Malloc mode (GPU Coder) parameter is set to unified, the code generator ignores this parameter and uses the C-styleemxArray data structure.

Dependencies

To enable this parameter:

Settings

Determine dynamic memory allocation interface based on language

When using the MATLAB Coder app, this is the default value. The code generator implements dynamically allocated arrays depending on the Language parameter.

Use C style EmxArray

When using the GPU Coder app, this is the default value. The code generator uses the C-style emxArray data structure to implement dynamically allocated arrays.

Use C++ coder::array

The code generator uses the coder::array class template to implement dynamically allocated arrays.

If you generate GPU code, the code generator also uses thecoder::gpu_array class template to access memory on the GPU. For more information, see Use Dynamically Allocated C++ Arrays in Generated Function Interfaces (GPU Coder).

Programmatic Use

**Property:**DynamicMemoryAllocationInterface
Values: "Auto" |"C" "C++"

Version History

Introduced in R2020a