Katharine;
You don't have to have Labview Professional to execute that task. As long as you compile the CVI code as a public access DLL, you can make a Call Library Function call from Labview.
Complete the following steps to create the DLL in CVI:
- Open CVI and create a new project (.prj) and a new source (.c) file.
- Edit the source file and add the following header lines:
/* Include files needed to compile DLL */#include #include /* needed if linking DLL in external compiler; harmless otherwise */#include BOOL __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){ return TRUE;}
- Add a simple function or any code you wa
nt to the DLL. Mark the functions you want to export as DLLEXPORT. The following example code multiplies a number by two.
void DLLEXPORT twise (double *my){ *my *=2; }
- Select Build » Target in CVI and change the target to Dynamic Link Library.
- Select Build » Create Dynamic Link Library. Make sure the Export What field is set to Symbols Marked to Export, as shown in the example linked below.
- Complete the following steps to use the DLL in LabVIEW:
- Open a new VI and place a Call Library Function Node on the block diagram.
- Right-click the node and select Configure from the shortcut menu.
- Navigate to the DLL you created.
- In the Function window, enter the name of the function you want to call, such as twise.
- Set the correct parameters and data types, as shown in the example linked below.
- Wire the appropriate inputs and output to and from the Call Library Function Node and set the input values. All input terminals must have
something wired to them.
- Save the VI.
- Run the VI. If all parameters are defined correctly, the VI should run successfully.
Hope this helps.
Filipe A.
Applications Engineer
National Instruments