Error on reusable function at code generation

13 views (last 30 days)
I have two different models, A and B, that both use a library block LIB_C. I set the code generation as recommended: LIB_C is atomic unit, reusable with user-defined function name and file name; the interface settings are set to place reusable code in a shared location.
I can generate code successfully from model A and B, if between each code generation process I erase the shared folder (slprj/ert/_sharedutils). In both cases, a single shared function is generated for LIB_C. The generated code for LIB_C is identical in both cases, except for the documentation header that contains the date and code generation model name.
However, what I really want to do is to generate code from each model seperately. I would expect to be able to reuse the shared folder files such that the second code generation reuses the first one's shared function for LIB_C. When I try to do this, I get the following error for LIB_C:
### Build procedure for model: 'modelB' aborted due to an error.
'modelA:939' and 'modelB:177' have the same function name but different interfaces. Try the following to eliminate this error:
1. Make the interfaces identical
2. Specify the configuration parameters to the same setting for each model or share the configuration set across models using a configuration reference.
3. Add a '$C' to the subsystem's Function Name setting to add a checksum to the system's function name.
To turn off reusable subsystem code across models, you can turn the 'GenerateSharedConstants' parameter off for all models containing the library subsystem.
If I generate code for modelB first, it's another similar library block that triggers the error.
I can successfully generate code from a model that combines the blocks from model A and B. In this case, a single shared function is generated for LIB_C and used by both the model A and B blocks. But now if I delete the blocks from model A (or B) from the combined model, and generate code, I get the error again, which does not make any sense to me since there are no new callers of the library block, I only removed a caller...
Can this behaviour be explained, what is the fix? Am I right to expect to be able to generate code from each model seperately and reuse the LIB_C code of the first model in the shared folder when I generate code for the second model? What are the conditions for code reuse with regard to library blocks?
  1 Comment
Swapnil Dongare
Swapnil Dongare on 10 Feb 2021
Hi David,
I was also facing same issue while creating SIL Block so, To sloved it i have followed some steps
  1. Kept same cofiguration setting for both the model (ref. and top level)
  2. Removed Slprj
  3. Removed all the model caches
and then it worked for me

Sign in to comment.

Answers (0)

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!