LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Attach your VIs! There are a myriad of possible problems. Very possibly related to 32-bit and 64-bit difference or some other mistakes. My magic crystal ball is however out of order so I can't look at the code that you haven't posted.

Rolf Kalbermatter
My Blog
0 Kudos
Message 11 of 13
(173 Views)

Oh sorry I have not yet been able to get it working. I've attached my VIs. Thank you for your help!

0 Kudos
Message 12 of 13
(150 Views)

I did take a quick look at the VIs. They seem to be fine in terms of being called from 64-bit. One thing I noticed is that you have the Calling Convention set to C and not Stdcall. This should make no difference in 64-bit mode since here we really only have Fastcall, and LabVIEW simply ignores the calling convention setting here. However the functions in the 32-bit DLL are defined Stdcall so if you ever plan to use this VIs in 32-bit mode, you'll not only have to change the library name in each but also go through each and change the calling convention.

 

The error you get from FT4222_SPIMaster_Init() would indicate that the FT4222 library doesn't feel like the device you try to open is 4222 compatible. Are you sure this is a real FT4222 device and not just some FT232 compatible device? Or maybe it is a counterfeit chip?

 

After FT4222_SPIMaster_Init() returns an error, it is TOTALLY unsafe to call any other FT4222_ function on that handle. Calling other FT4222_ functions should of course check the handle that it is properly initialized for the operation at hand but it may not be able to do so reliably and then tries to access memory locations that haven't been properly initialized because FT4222_SPIMaster_Init() was not successful!

 

The only thing that you can do with that handle after FT4222_SPIMaster_Init() returned any error, is to use normal FTD2xx functions on it. Your function library for these should check the error status, and create an according error status in the error cluster when the return value does not indicate success. And only FT_Close() and maybe FT4222_Uninitialize() should try to run anyways on an incoming error.

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 13
(128 Views)