Why Calling a LabVIEW DLL in Python Always Return 0 Value?

Updated Aug 30, 2023

Reported In

Software

  • LabVIEW

Programming Language

  • Python
  • LabVIEW G

Issue Details

I am writing a basic code in LabVIEW, which implements simple add or multiply functions and generates double precision output. When compiling this VI as a shared library (DLL) in LabVIEW and calling it in Python using a 'ctype' library, I always get '0' as the return value.

Solution

Getting '0' as the return is because of the data type mismatch between LabVIEW and Python. A correct data type mapping between LabVIEW and Python is needed when a LabVIEW shared library is called. For instance, if 'double' precision in LabVIEW code is changed to 'Int32' (Right Click>Representation>I32), the shared library (DLL) works well without any problems in Python using 'ctypes' library.