I understand that you are encountering the error "Data dictionary 'x.sldd' linked by a library must not have access to base workspace".
This occurs because a library-linked SLDD (Simulink Data Dictionary) is configured to access the base workspace, which is not allowed by design.This restriction is enforced by Simulink’s internal reference manager.
Why this restriction exists:
When a model links to a data dictionary from within a Simulink library, it is meant to behave as a standalone, reusable, and self-contained component. If such a dictionary accesses the base workspace, then:
- It introduces external dependencies that break modularity.
- It creates ambiguity during code generation or model reference builds, since workspace values may vary per context.
- It makes model reuse fragile, especially across projects or in deployment workflows (like Simulink Coder or rapid prototyping).
To enforce robust and portable model behavior, Simulink prohibits any SLDD used within a library from referencing the base workspace, either directly or indirectly (even through referenced dictionaries).
You are right to observe that some models using SLDDs with base workspace access don't throw this error. The key distinction is that those models are not libraries.
This restriction only applies when the dictionary is:
- Linked to a Simulink library model, not a regular model.
- Referenced in the closure of the library, i.e., any dictionary in its dependency chain.
The issue can be resolved by disabling base workspace access for the offending dictionary. Make sure to also review any referenced dictionaries within this one; if they have workspace access enabled, the error will persist due to indirect dependency.
Please refer to the following documentation to learn more about how Simulink handles dictionary linking in libraries and best practices when designing such models:
I hope this helps.