FAQ 748: TargetLink: How to Generate Common *.h/.c Files Used in Several CGUs?

Question

I have a .c/.h file (let’s call it my_common_functions.c/h) which contains several functions and is shared across multiple CGUs (code generation units). I experience problems because multiple production code versions of this file are generated. A typical scenario for this is a Simulink library that contains multiple subsystems. Each of the subsystems has a TargetLink function block and the same module (my_common_functions) is specified.

When code for a CGU is generated, the CGU generates my_common_functions.c/h, which contains only the used functions of this CGU. This typically leads to none of the CGUs generating a complete my_common_functions.c/h.
Therefore, when building the application for the all CGUs, compiler and linker errors can occur.
How can I get a complete my_common_functions.c/h?

Answer

Tags
Date 2019-08-15
Software Type Production Code Generation Software
Product TargetLink
Information Type Frequently Asked Questions
Information Category Working with, Troubleshooting
dSPACE Release 2023-A, 2022-B, 2022-A, 2021-B, 2021-A, 2020-B, 2020-A, 2019-B, 2019-A, 2018-B, 2018-A, 2017-B , 2017-A, 2016-B, 2016-A, 2015-B, 2015-A, 2014-B, 2014-A, 2013-B, 2013-A, Prior to 2013-A

Stay up-to-date with our dSPACE direct newsletter service.

With our dSPACE newsletter service, we will keep you informed about current use cases and new solutions and products, as well as trainings and events. Sign up here for a free subscription.

Enable form call

At this point, an input form from Click Dimensions is integrated. This enables us to process your newsletter subscription. The form is currently hidden due to your privacy settings for our website.

External input form

By activating the input form, you consent to personal data being transmitted to Click Dimensions within the EU, in the USA, Canada or Australia. More on this in our privacy policy.