05-03-2024 12:36 AM
Hello all ,
Is there any different between calling a dll from cvi to calling it on teststand ?
asking because i have a large data set i pass to a dll i got from a vendor created in c++ visualstudio .
it works just fine when i call it from exe file i created in cvi . but when calling from teststand i experience misplaced data like shift( huge struct) .
i checked for alignment problems its not the issue . i suspect maybe memory usage or something like that , that is different when calling a dll from teststand .
thanks ahead.
05-03-2024 05:52 PM
Take a look at the C/C++ Struct passing example:
C:\Users\Public\Documents\National Instruments\TestStand 2019 (32-bit)\Examples\Fundamentals\Passing Structs to Code Modules\C
You create TestStand types that match the struct and set the properties to align with the data; and note that there are different packing options depending on how the DLL was built.
"The development environment that you use to create DLLs determines the options for the structure packing value.
Visual C++ and Symantec C++ use a default of 8-byte packing. LabVIEW, Borland C++, and Watcom C++ use a default of 1-byte packing. For LabWindows/CVI, the default packing can be 8-byte or 1-byte, depending on the compatibility mode. For example, in Visual C++ compatibility mode, LabWindows/CVI uses a default of 8-byte packing."
And then you can retrieve the data by reference or value which dictates how you will set your module step settings
05-05-2024 12:30 AM
First of all , thank you for the response .
i have my struct aligned to the struct in the dll moreover, i also have a function call that accepts the fields of the struct instead of the struct and building it all inside the dll . the problem is still there .
i can explain in more detail what the problem is if you think it might help , but in general its a nested struct that the 1 before last field being shifted and it also effects the data that i want to pass to the last field (like the field before last takes all the space than i cant reach last field).
having said that, when i repeat the same function call passing the same arguments it might work on the third-forth-fifth time or even at first time
but having a loop for my whole testing is problematic .