I am trying to control a FT601 USB3 interface chip via a C# wrapper that FTDI provide. Unfortunately, they don’t provide an example of using VB.net to do this, but advise that it should be possible. I have written a simple test program to see if this works and it appears to have no errors, but running the call results in a ‘System.IO.FileNotFoundException’, despite having referenced the dll in the project. It seems that I may not be calling the dll correctly, but I haven’t spotted the problem.
Module Module1
Public Sub FTDread()
'Find & Open all FTDI devices attached
Dim ftStatus As FTDI.FT_STATUS = FTDI.FT_STATUS.FT_OK
Dim d3xxDevice As New FTDI()
Dim ulNumDevices As UInt32
ftStatus = d3xxDevice.GetNumberOfDevicesConnected(ulNumDevices)
If ftStatus <> FTDI.FT_STATUS.FT_OK OrElse ulNumDevices = 0 Then
Return
End If
MsgBox(ulNumDevices)
End Sub
End Module
Here is the error as shown in VB.net
Exception thrown: ‘System.IO.FileNotFoundException’ in StarMos.dll An
exception of type ‘System.IO.FileNotFoundException’ occurred in
StarMos.dll but was not handled in user code Could not load file or
assembly ‘FTD3XX_NET, Version=1.3.0.10, Culture=neutral,
PublicKeyToken=null’. The system cannot find the file specified.‘StarMos.exe’ (CoreCLR: clrhost): Loaded ‘C:Program FilesMicrosoft
Visual
Studio2022CommunityCommon7IDEPrivateAssembliesRuntimeMicrosoft.VisualStudio.Debugger.Runtime.NetCoreApp.dll’.
Skipped loading symbols. Module is optimized and the debugger option
‘Just My Code’ is enabled. ‘StarMos.exe’ (CoreCLR: clrhost): Loaded
‘C:Program
FilesdotnetsharedMicrosoft.NETCore.App7.0.15netstandard.dll’.
Skipped loading symbols. Module is optimized and the debugger option
‘Just My Code’ is enabled. The program ‘[29168] StarMos.exe’ has
exited with code 4294967295 (0xffffffff).
Terry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
7
Based on FTDI’s website code examples, you should have two dlls in your project:
a) FTD3XX.dll (base DLL)
b) FTD3XX_NET.dll (wrapper)