04-06-2018 08:39 AM
Hi everyone,
I am facing a problem configuring a CLF in Labview 2015-64.
I have a dll which is written in C++ (code is available) and need to be called in Labview for indication purposes. The dll should be called once and I need to keep reading the result as it is being updated.
Hier is a sample code in C++, and the goal is to read the sum pointer in LV as it is being updated in dll: (correct me please if the C++ code should be changed!). dll is also here attached.
__declspec(dllexport) void test_sum(int iteration, int waitTime, int *sum) { for (int i = 0; i < iteration; i++) { *sum = i + 1; Sleep(waitTime); //wait in ms } }
Here is the LV code I have made, it does not crash but just gives me only the last value (here 20). But I expect to copy the memory from the pointer every 2ms in the while loop and showing me the values from 0 to 20!
Any help or hint is greatly appreciated.
Solved! Go to Solution.
04-06-2018 08:58 AM
Why is the size 8? An I\U32 is 4 bytes?
You might try not running the dll in the user interface thread. It might block the UI thread regardless the Sleep.
04-06-2018 09:51 AM - edited 04-06-2018 09:51 AM
wiebe@CARYA wrote:
You might try not running the dll in the user interface thread. It might block the UI thread regardless the Sleep.
You can leave the "might" away. Make it:
You MUST NOT running the dll in the user interface thread. It WILL block the UI thread regardless the Sleep.
04-06-2018 01:44 PM
Hi Rolf and wiebe,
thank you for the quick response. That was totally correct.
I had this problem before but apparently lessons not learned 😞
Hopefully everything will work when I change it to U8-2D array.
Thanks again.