Running compiled model C++ in a pc without Visual Studio

Running compiled model C++ in a pc without Visual Studio

lucas_klein
Not applicable
16 Views
7 Replies
Message 1 of 8

Running compiled model C++ in a pc without Visual Studio

lucas_klein
Not applicable

Dear all,

I built a model in FlexSim using some functions in C++ in a computer that have Visual Studio 2013, the model compiles and run normally. Then I copied this model to another computer that does not have Visual Studio, when I pressed "Run", FlexSim asked me to compile my model first before run, and it could not be able to compile because detected some syntax errors, while the model in the other computer compiled with no problems.

How can I save a model already compiled in FlexSim to just reset and run in a computer without Visual Studio? There is any way, or it's needed to have VS installed to use C++ functions in a model?

0 Likes
Accepted solutions (1)
17 Views
7 Replies
Replies (7)
Message 2 of 8

philboboADSK
Autodesk
Autodesk
Accepted solution

If you want to distribute compiled C++ code, you need to build that code into a DLL that you distribute alongside your model.

See Creating DLLs that attach to Flexsim



Phil BoBo
Sr. Manager, Software Development
Message 3 of 8

lucas_klein
Not applicable

In case, I am using a big code that is executed many often, transforming it to DLL could increase the performance of the model, or using FlexScript I have a better performance?

Message 4 of 8

philboboADSK
Autodesk
Autodesk

You'll have better performance compiled into a DLL.



Phil BoBo
Sr. Manager, Software Development
Message 5 of 8

lucas_klein
Not applicable

@phil.bobo I tried to use DLL to execute my code, but when I tested the performance in the FlexScript Code Profile, it executed slowly than using FlexScript, follow attached the print of Code Profile log between FlexScript and DLL. The code changed to DLL was the "pintar_grupos". Also I'm attaching the code in a blank model for any eventual consults. code-model.fsm

0 Likes
Message 6 of 8

philboboADSK
Autodesk
Autodesk

Please post this as a new question with relevant replication steps and all the data necessary to replicate these results on our end. Mark the question as private if the model is confidential. Also explain what version of the software you are using.

This looks fishy. Perhaps the total time is including the time that the software attached to the DLL for the first time, and it won't be that high if you clear the data and run it again after it is connected. Perhaps the code profiler has a bug. Perhaps one of the function overloads you are using goes down a different code path in C++ than FlexScript that has a performance bug.

You are also using a lot of deprecated commands, such as makearray(), fillarray(), and a bunch of those table commands. You are also using a node() lookup by name, which will have different performance depending on the order of the objects in your tree and how many there are in the tree. There are too many possibilities to explain why you are seeing what you are seeing based on a screenshot of the Code Profiler and a model with a single code snippet.

Also, this code isn't particularly "big" unless you have a ton of rows in your Tabela_GrupObj_Cores table. Why are you trying to optimize something that takes less than a second of the time in your simulation?



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 7 of 8

SCHamoen
Advisor
Advisor

@Lucas KleinAre you compiling in debug mode or release mode? That usually also has a big impact

Message 8 of 8

philboboADSK
Autodesk
Autodesk

Good call Steven. That was the issue.



Phil BoBo
Sr. Manager, Software Development
0 Likes