How to compile a DLL file to be externally configured
1 visualización (últimos 30 días)
I'm learning about Embedded coder to automatically generate DLL from Simulink models to be used by 3rd parties.
I'm using the system target file ert_shrlib to obtain the DLL file from Simulink model.
I want to get an externally configurable DLL without using the less input ports as possible.
I have done some tests with simple blocks such as product or gain blocks, to generate DLL.
At this moment, I'm trying to configure a gain block by changing the its value in the workspace without a new compilation process.
I have used SimulinkParameter to set parameters with the storage classes SimulinkGlobal and ExportedGlobal but the DLL looks to be frozen with the gain value used when the DLL was generated.
If I want to change the gain value I need to rebuilt the DLL and this is not acceptable.
If I use the storage class ImportExtern I received an error when the DLL is compiled, saying that the gain value used in the model is undefined.
The SimulinkParameter is defined in the workspace, but in the generated C and H files I don't find any initialization of the gain value and no function to update this value (the gain is declared but not initialized). This is the reason of the error.
I think that I missed to click on some option that I must enable/disable to allow to use the data from workspace when the DLL compiled with the storage class ImportExtern.
Could anyone provide me some advice?
If anyone could provide another different approach to obtain the described behavior I will appreciate to hear about more option.
I have thought about using a header file full of defines to set initial values, but when I load the DLL file using the new header configuration, the gain value does not change from the value used when the DLL was generated.
Thank you in advance.
Darshan Ramakant Bhat el 18 de En. de 2018
Below MATLAB answer posts discusses about the similar issue:
I hope this will help you.