03-25-2011 09:05 AM
Lectori Salutem,
Here is the situation:
Im learning TestStand, and to learn the basics, I want to do the following:
Call a (C++) DLL in TestStand with an array of chars.
The DLL should return the array of chars (or a pointer to the datalocation).
This is the code in my DLL:
//////////////////////////////////////////////////////////////////////////////
However, this function will not be recognized by TestStand 😞
When this is working, I think I can build the rest of the functionality by myself.
Thanks in advance for any help!
Jeroen
The Netherlands
Solved! Go to Solution.
03-28-2011 01:47 AM
Hi Jeroen,
Have you ever looked in TS-Example foulder: Examples\AccessingPropertiesUsingAPI\UsingMFC
In this Example there is a hole Visual Studio Project. Maybe you can use this for starting on scratch.
For passing strings back to TS, you should take a look on the CVI c-code Example in
Examples\Demo\C\Auto.c "Ignition_Test(xxx)"
Hope this helps
Juergen
03-28-2011 02:16 AM
Sadly, in the example there is no return value to TestStand.
However, I did manage to return the pointer of the char array to TestStand:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
03-28-2011 03:42 AM
Fixed it 😄
It turns out, I had to declare a string variable in TestStand.
TestStand:
declare Locals.Text (string)
call the DLL module, with arg1 = char[1024] = Locals.Text
After calling the DLL, Locals.Text becomes Hello :D:D
Visual Studio DLL code:
Anyone, thanks for the help!
Jeroen
03-28-2011 11:10 AM
Just to expand on this for anyone who finds this post later.
TestStand doesn't support functions that return char* because it can't deallocate the memory. So if you need a string back, it has to be passed as a parameter.
See this post by a TestStand devloper for more info: