C # DLL runtime error - builds, starts, but throws an unhandled exception when trying to use DLL functions

I am trying to compile a sample project shown here for C #. It needed to be converted to VS2010, but it worked fine. It builds, starts, but then dies when it tries to access a DLL function.

I made a series of images to show my steps. As you can see, the device that I designed is connected and configured correctly, but I really do not think this has anything to do with the problem. Inside the Form1.cs file, the following comment explains how to use the DLL:

/*
PLEASE NOTE
You must add a reference to the FTChipIDNet.dll in order to use this sample
To do this:
1. Click on Solution explorer tab.
2. Right click the References tree.
3. Choose Add Reference option.
4. Browse to the FTChipIDNet.dll (as a personal preference I place this in my bin directory)
5. Click OK
*/

I followed the instructions above and fixed the undefined link to the FTChipID namespace. I also manually checked the Object Browser to make sure the GetNumDevices function exists, and it does.

Pressing the button causes this error:

DLLNotFoundException was unhandled:

Unable to load DLL 'FTChipID.dll': the specified module was not found. (Exception from HRESULT: 0x8007007E)

in this line of code:

FTChipID.ChipID.GetNumDevices(ref numDevices);

Now you might think: "the error says that it needs FTChipID.dll, not FTChipIDNet.dll." I am wondering the same thing. I have FTChipID.dll along with the .lib and .h files, but I don’t know how to use them or where they should be for this program to find them. I tried to add a link to FTChipID.dll, but VS2010 said

... \FTChipID.dll . , , COM.

, . ? .

+5
3

FTChipIDNet.dll - FTChipID.dll, ( ), FTChipID.dll bin , FTChipIDNet.dll.

dll bin windows\system32.

+2

FTDI "CSChipID" VS2013, " ". DLL "FTChipID.dll" "FTChipIDNet.dll" bin, DLL, "FTChipID.ChipID.GetNumDevices(ref numDevices)"; - "x86" .

- Configuration Manager - "x86" . "x86" , "...", "x86".

+2

It seems that there are several DLL files: like FTChipIDNet.dll (the one you are interacting with) and FTChipID.dll (the one who has an actual, non-COM function that does not have network access). You need both.

PROPOSAL: copy both to the \ windows \ system32 directory

0
source

All Articles