How Can I Generate a 32-bit DLL from a Simulink Model on 64-bit MATLAB?
44 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 18 Déc 2019
Modifié(e) : MathWorks Support Team
le 22 Sep 2021
I am using a 64-bit MATLAB installation to develop Simulink models on a 64-bit Windows machine, and had been able to build 64-bit DLLs from these models using Visual Studio compilers.
Now, I would like to build those same models as 32-bit DLLs. How could I be able to achieve this?
Réponse acceptée
MathWorks Support Team
le 20 Sep 2021
Modifié(e) : MathWorks Support Team
le 22 Sep 2021
The best way to set this up is by registering a custom toolchain for your build process. A toolchain is simply a collection of tools used to build the code that gets generated from one of our coder products (in this case Embedded Coder generating code from a Simulink model). Now generally speaking custom toolchain registration can be somewhat involved as there is a lot of flexibility in this method and specifying all of the different aspects can be time consuming. Fortunately we already have an example that registers a toolchain for building a 32 bit DLL on a 64 bit windows machine using Visual Studio! You can find the example at the following documentation page:
The example itself is in the form of a script that registers the toolchain for use with MATLAB Coder, but all toolchains can be used across the Coder products so it should be suitable for our purposes as well.
To start, follow the example up until the section titled "Create Code Generation Configuration Object". This means the last command you should have run should be "RTW.TargetRegistry.getInstance('reset');" We don't want to run the whole example because they remove the new toolchain in the clean up at the end of the example. Notice that there's a 'tc' variable of class Toolchaininfo created in the base workspace.
Then we need to open the Simulink model and make a few modifications to ensure that we are setup properly to use the new toolchain. First we modify the Hardware implementation to specify that we are targeting a 32-bit Windows computer as seen below:
Next we need to ensure that we are using "ert_shrlib.tlc" to generate our shared library.
Save the model, close the configuration parameter pane and reopen it. Then, all we need to do is choose our new toolchain from the list of toolchains:
And then we should be all set to generate a 32 bit DLL.
For more information about custom toolchains, you can look at the following documentation page detailing the various steps of custom toolchain creation and registration:
Some potential troubleshooting steps:
Sometimes after setting the hardware the toolchain still does not appear under the dropdown. To resolve this make sure that the hardware settings have been applied, and close the configuration parameters. Reopen the configuration parameters and you should see the toolchain appear as an option. Additionally saving the model after applying the hardware change can allow the new toolchain to be found.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!