# Component Data API

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_include_le_cdata_h.html#file-le-cdata-h)

In some contexts (e.g. on real-time operating systems) a single process may contain multiple instances of a component. Ordinary global or static variables will be shared across all instances of the component in the process. The Legato Component Data API provides a method to associate data with a specific component instance.

To create per-component instance data, use the LE\_CDATA\_DECLARE macro to declare your per-instance data at file scope:

LE_CDATA_DECLARE({
        int numFoo;
        char* fooStr;
    });
    Copy to clipboard

Only one component instance data can be declared per-file, and this data is only available within the file where it’s declared.

Then use `LE_CDATA_THIS` to access the current component instance’s data. For example:

LE_CDATA_THIS->numFoo = 5;
    Copy to clipboard

Copyright (C) Sierra Wireless Inc.

Last Published: Jun 09, 2026

[Previous Topic
Legato APIs](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/legato_apis.md) [Next Topic
File Descriptor API](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/file_descriptor.md)