Is there way to reuse the same memory location of the input for the outputs - essentially passed by reference? The use case I have is, a structure containing several parameter and flags are passed into a stateflow block then after processing, the some flags in the same structure is modified then outputted to the next blocks, then consequent blocks do similar things and passes the next and so on.
In the generated code, the input structure is copied to a local variable, then the new instance of structure is passed out to the next block. Due to the efficiency reason, I would like to avoid creating the local copies.
One workaround I tried is to use DataStoreMemory and set it as global variable, but the deficiency comes from the fact that when multiple block tries to access the variable, execution order is not guaranteed unless I set the block priorities. This approach sort of works but is not preferred due to the readability reason (want to have a signal line going from one block to next).
Do anyone have any suggestions on how to achieve this efficiently without relying on the DataStoreMemory?