LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to create DLL from VI to use in TestStand.

Solved!
Go to solution
I trying to create a DLL out of an existing VI file.  The VI has about 4 inputs and about 3 outputs.  If I go to Tools >> Build Application and select the Build Target as a "Shared Library (DLL)" i get a dll after the build; but when I try to call that DLL from teststand, it doesn't recognize any of the inputs or outputs.  How do I build a DLL so that teststand will reconize the inputs and outputs?
0 Kudos
Message 1 of 13
(4,578 Views)
What adapter are you using?  If you created a dll then you should use the C/C++ adapter.
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 13
(4,576 Views)

The adapter is set to C/C++ adapter when calling the DLL from Teststand.  Is there something special that needs to be done when doing the build other than setting the build target to "Shared Library (DLL)"?

 

btw: I have Labview 7.1 and TestStand 3.1

0 Kudos
Message 3 of 13
(4,568 Views)
I thought TestStand could call a LabVIEW vi directly (as long as LabVIEW is installed) without it needing to be compiled.
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 4 of 13
(4,555 Views)

Troy,

 

It can except that F22 wants to do it as a dll.  As far as I know it should just work.  I am installing 7.1 right now to test it out.  I'll let you know what I come up with.

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 13
(4,553 Views)
I've built many, many LabVIEW DLLs that have been called by TestStand and it works just fine. What I am unsure of is the statement "it doesn't recognize any of the inputs or outputs". I don't know if that means after defining the proptype in TestStand, it's not passing any data to or from the DLL or whether the prototype information is not automatically displayed. For the latter, the datatypes in the .h file have to be something that TestStand will recognize so it's important to know how the dll was created and what are the inputs and outputs. Even if it's not automatically populated, you can manually add arguements and define the datatypes to match what TestStand uses.
0 Kudos
Message 6 of 13
(4,541 Views)

F22,

 

Are you connecting your controls and indicators to the connector pane?  Everything seemed to work fine for me.  Also, after you select the dll in the specify module for that step, can you see the function (i.e. VI name) in the Function Name drop down?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 13
(4,519 Views)

The controls and indicators are connected to the connectors.  Also, answering an earlier post, the prototype information for the inputs and outputs are not automatically displayed. I can manually define the prototypes, but then the question is how does each prototype link to its corresponding parameter (by name?). I've also tied creating just a simple VI that has just one string input and one string output.  I built the VI to a DLL and tried calling in TestStand and i get the same results.  I've inserted the resulting header file after that build.  Which, by the way, looks exactly like my other created DLL's header file.  The difference in bold(the name of the VI). Which makes me thik that my build DLL process might be off.

 

#include "extcode.h"

#pragma pack(push)

#pragma pack(1)

 

#ifdef __cplusplus

extern "C" {

#endif

 

void __stdcall String_input_output(void);

 

long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);

 

#ifdef __cplusplus

} // extern "C"

#endif

 

#pragma pack(pop) 

0 Kudos
Message 8 of 13
(4,508 Views)
Your build does seem to be off. I just created a VI with a string input and string output and got "

void __stdcall Dll_demo(char String[], char String2[], int32_t len);" This in the header All that you have is "void'. When you created the dll, did you click the Define VI prototype on the Source Files tab?

0 Kudos
Message 9 of 13
(4,502 Views)

Looks like that helped a little.  As you can see from the new header the prototypes are there.  But still when i call the DLL from TestStand there are no inputs and outputs.  I can select my function, but when i hit reload prototypes it errors whit "This function either does not have parameter information or ...".  Anything else about the build that i'm missing?

 

 

#include "extcode.h"
#pragma pack(push)
#pragma pack(1)

#ifdef __cplusplus
extern "C" {
#endif

void __stdcall HW_SelfTest(char LRMType[], LVBoolean *Bus, char RearMUTID[],
 char FrontMUTID[], char MIDEID[], char ReportText[], LVBoolean *PassFailFlag,
 LVBoolean *Run_FW_SBIT, long len);

long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);

#ifdef __cplusplus
} // extern "C"
#endif

#pragma pack(pop)

0 Kudos
Message 10 of 13
(4,485 Views)