LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems importing a shared library (LibFT4222-64 from FTDI)

I am having problems trying to import a shared library (LibFT4222-64 from FTDI).
The library is created along with the associated VIs.
There are no errors or warnings when parsing the header file.
I get a report at the end, from LabVIEW saying that the VIs are not executable.
Does anyone have any ideas as to what I am doing wrong?

0 Kudos
Message 1 of 13
(2,060 Views)

Most likely those functions all use a HANDLE type, which is a pointer to void. If that is the case you need to reconfigure those parameters to be Pointer Sized Integers and replace the control with an 64-bit integer.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 13
(2,045 Views)

Thank you for your reply.

The LabVIEW import tool seems to handle the parameters correctly. The types of the controls and indicators in the VIs match the function prototype:

Dave_RS_1-1647363384469.png

 

The problem I see when I try to open the VIs generated by the import is "Library not found or failed to load":

 

Dave_RS_2-1647363727554.png

 

 

0 Kudos
Message 3 of 13
(2,023 Views)

Well that error message usually indicates that the path to the DLL is incorrect.  If that's the case, you have two options.  Either open the DLL configuration and browse to it, or set the DLL node to use a dynamic path and wire the DLL as a path to the VI.

 

However, it could also be a bitness issue.  It could be that a you're using 32 bit LabVIEW to call a 64 bit DLL, or vice versa.  The name of the DLL does imply that it's 64-bit.

0 Kudos
Message 4 of 13
(2,020 Views)

Where did you install that DLL? Did you install it anywhere even?

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 13
(2,017 Views)

Hi Kyle,

 

Thank you for the suggestions.

The import wizard sets up the call with the DLL path, with a wildcard:

C:\Program Files\National Instruments\LabVIEW 2021\user.lib\LibFT4222-64\LibFT4222-64.*

Browsing to the DLL does not change the error message.

C:\Program Files\National Instruments\LabVIEW 2021\user.lib\LibFT4222-64\LibFT4222-64.dll

 

I am not convinced that using a dynamic path will make any difference. I am inclined to think it will just change the point at which the error is reported (at runtime).

I might try that if all else fails, but I have never had to do it that way before.

 

You are right about using a 64-bit DLL. I am trying to run it on 64-bit LabVIEW, so that should be OK.

0 Kudos
Message 6 of 13
(1,973 Views)

Thank you for your reply Rolf,

 

I installed it to:

C:\Program Files\National Instruments\LabVIEW 2021\user.lib\LibFT4222-64

 

There are two device drivers that get installed, via an FTDI application.
As I understand it, the API level DLL (LibFT4222-64) that sits on top of the device drivers, handles all the user interaction.
I downloaded this API from FTDI and imported it into LabVIEW. The importation process generates the LabVIEW library and places the DLL in the same place.

0 Kudos
Message 7 of 13
(1,967 Views)

@Dave_RS wrote:

Thank you for your reply Rolf,

 

I installed it to:

C:\Program Files\National Instruments\LabVIEW 2021\user.lib\LibFT4222-64

 

There are two device drivers that get installed, via an FTDI application.
As I understand it, the API level DLL (LibFT4222-64) that sits on top of the device drivers, handles all the user interaction.
I downloaded this API from FTDI and imported it into LabVIEW. The importation process generates the LabVIEW library and places the DLL in the same place.


Did you really install it or just copy it into that location? That is not the same at all. DLLs are compiled with a compiler and compilers tend to require runtime libraries. These runtime libraries tend to be compiler version specific and unless they are explicitly linked into the DLL (which is not the default and makes them larger), this runtime library needs to be installed on your system. And yes I mean installed, copying some extra files is usually not enough as it is not trivial to track down all the possible dependencies and they may vary depending on the OS version you want to use them on.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 13
(1,962 Views)

Hello,

 

I was having the same issue when trying to import the LibFT4222-64.dll library, but I was able to successfully import after adding the paths to ftd2xx.h and stdint.h.

 

dkim2_0-1738192515476.png

 

However, the issue is that I cannot reliably use the functions in the library. I was only able to run the functions with no FT_Status errors once, but got a LabVIEW error 1097. After this I was unable to replicate this behaviour even after restarting labview, creating a new VI, etc. and keep getting a FT_4222_DEVICE_NOT_SUPPORTED error for the first instance of the library function call and FT_DEVICE_NOT_OPENED errors for calls afterwards. 

 

dkim2_2-1738192657119.png

 

dkim2_1-1738192642978.png

dkim2_3-1738192776633.pngdkim2_4-1738192783008.png

 

It doesn't seem to be a problem with the dll or my FTDI devices because I can successfully initialize SPI with the same parameters and no errors from Visual Studio, and I'm not sure what I'm doing wrong in LabVIEW. 

 

Please let me know if you were able to successfully use any of the functions from the LibFT4222-64.dll library and what steps you took, thank you.

0 Kudos
Message 9 of 13
(345 Views)

Hi dkim2,

 

Were you able to get the libFT4222-64.dll working? I am running into a similar issue where I am able to successfully run the ftd2xx64.dll working with FT_Open, however when I execute FT4222_SPISlave_Init it returns FT_4222_DEVICE_NOT_SUPPORTED. 

 

I am able to get it working in 32-bit labVIEW with the libFT4222.dll as well as in Visual Studio in both 32 and 64-bit, but its the 64-bit labVIEW where I am unable to get it to work. 

 

Thanks,

0 Kudos
Message 10 of 13
(316 Views)