question

Lucas Klein avatar image
1 Like"
Lucas Klein asked Benjamin W2 commented

Access array labels with DLL

Dear all,

I am having a problem using DLLs in FlexSim to access an array label in an object of my model. The label itself is an array that contains arrays in each element of it:

I've created a model and a DLL to exemplify the situation, both follow attached.

The DLL is called by an user command with DLL template, and the code of the DLL contains the following:

Basically the DLL receives the object, reads the matrix label and tryes to read the 3rd element of the 1st element of the array. Running the code this way does not work, getting me an exception at the System console:


But if I comment the line of number attribuition and ask to the DLL print the array

It works nice and prints me te following:

What should I do so I can access the data in that array by DLL? Since I've tried to use Variant, int, double, another array and I can't get these data out of the label.

Test_DLL_Array.rar

Thanks in advance.

FlexSim 20.1.2
flexsim 20.1.2arraydll maker
1591292635513.png (17.3 KiB)
1591292818062.png (45.9 KiB)
1591292925599.png (52.2 KiB)
1591293104927.png (14.2 KiB)
1591293170763.png (27.3 KiB)
test-dll-array.fsm (24.9 KiB)
test-dll-array.rar (100.2 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Benjamin W2 avatar image Benjamin W2 commented ·

Hi @lucas.klein, was phil.bobo's answer helpful? If so, please click the red "Accept" button on their answer. Or if you still have questions, add a comment and we'll continue the conversation.

0 Likes 0 ·

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

The DLL Maker includes header files from the FlexSim content. The default header files in the DLL Maker repository are from an older version of FlexSim. The feature you are trying to use requires updated header files.

Copy the following files from the version of FlexSim you are using to the DLL Maker project:

When you try to compile the DLL Maker project with those files, you will likely get errors because the DLL Maker by default is build using the Visual Studio 2013 platform toolset. You'll need to change the settings on the project to use a newer platform toolset so that you have the latest C++ features required by the newer files.

Once you have done those two steps, then it will work the way you want.


1591299052641.png (514.5 KiB)
1591299202758.png (188.8 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.