September 17th, 2013, 10:51 AM
Passing data from a file to DLL
I need to use Python to open a file which has a set of data (1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0) and pass those data into LABVIEW in DLL.
I try to use command below to open a file and read data from file but I have no idea how to pass argument into LABVIEW.DLL. I managed to do it with constant values in degC_array.
fp = open('C:\\ExamplePytoLV\\Invensys Python calling LabVIEW\\TestDocument1.txt')
This is my code as below,
from ctypes import CDLL, c_double,c_int32
N = 12
TenDegC = (c_double * N)
TenF = (c_double * N)
degC_array = TenDegC(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0)
F_array = TenF(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)
error = c_int32
for i in degC_array: print (i)
#Load DLL in to memory
CtoFDLL = CDLL ("C:\\ExamplePytoLV\\Invensys Python calling LabVIEW\\CtoF.dll")
for i in F_array: print (i),
September 17th, 2013, 02:22 PM
Did you succeed? "...I have no idea how to pass argument into LABVIEW.DLL. I managed to do it..."
I don't have labview, but may later find labview manuals. What error or problem did you observe?
[/code] are essential for python code and Makefiles!
September 18th, 2013, 03:07 AM
Sorry for not explain clearly. Yes, I managed to integrate LABVIEW DLL. But, I have no idea how to write output data from LABVIEW DLL into a text document using Pyhton.
Originally Posted by b49P23TIvg