0
votes

I'm working for the first time with ctypes to import DLLs. The DLL which i've imported contains a function wich return a DWORD value. How can I convert this DWORD value?

for other functions which takes WORD arguments values i tried something like this ( found in stack overflow).

from ctypes import *
my_dll = ctypes.windll.LoadLibrary (r"C:\\Users\\Mimouni\\Documents\\FFT_python\\Sense2020Dll.dll")
py_DLL_Acquire_Spectrum = my_dll.DLL_Acquire_Spectrum
py_DLL_Acquire_Spectrum.argtypes = [POINTER(c_double),POINTER(c_double),POINTER(c_double)]
py_DLL_Acquire_Spectrum.restype = None
pdblWavelength = (c_double)(my_dll.DLL_Get_Pixel_Count()) 
pdblPower = (c_double)(my_dll.DLL_Get_Pixel_Count())
pdblTemperature = (c_double)(0)
py_DLL_Acquire_Spectrum(pdblWavelength,pdblPower,pdblTemperature)

How can I use wintypes for returned values ?

Thank you in advance.

1
What is the problem with the above code? Please also post the C (header) declarations for the function you are use.CristiFati

1 Answers

0
votes

If you have a variable x of type DWORD (which is just an alias for ctypes.c_ulong), you can just use a.value to get its int value.