1
votes

I am getting what seems to be a common issue in my C# program.

I have been looking online in many places and tring different solutions. ALl of whihc have so far failed.

I came across this post and tried their solution which did not work: Unable to load DLL The specified module could not be found

I downloaded dependancy walked to see if I was missing any other dlls which, it is reporting that I am but those dlls are the win-API dlls. Which according this link: https://social.msdn.microsoft.com/Forums/en-US/a28331ae-19a3-4a34-b3ba-1e8fd4430375/missing-apimswincore-dlls, it doesn't matter if dependency walker reports those as missing.

I have also downloaded and installed the VC++ redistribute 2015 x64 and x86 and I am still recieving the same error.

There was another post that recommended that I install the windows SDK. I did this for windows 10 and again, still the same error.(Missing dlls on 64 bit Win).

I have even tried placing the dll in system32 folder but again, no issue

I am running out of ideas on how to solve it so if anyone else ran into the same issue, any help would be appreciated.

For those wondering, I am developing on win 10 using VS2015.

EDIT:

The name of the DLL that I am using is called: SLABHIDtoUART.dll

My code for importing the functions is a as follows:

[DllImport("SLABHIDtoUART.dll")]
        public static extern int HidUart_GetNumDevices(ref uint numDevices, ushort vid, ushort pid);

Here is the exact error:

System.DLLNotFoundException: Unable to load DLL 'SLABHIDtoUART.dll': The specified module could not be found (Exception from HRESULT: 0x8007007E)

Oh and I did change the compiler settings in VS from Any CPU to x86. Technically, I did not have that as an option by default and I needed to add a new option for the x86. After a recompile with the x86 compiler, the program still doesn't seem to be working.

I even moved all of the DLLs that the SLAB dll depends on and ran the program and the program still did not run. (SLAB dll depend on hid.dll, setupapi.dll, and kernal32.dll)

1
what is the name of the DLL which is not being loaded?Dave S
You haven't given nearly enough specifics. Which DLL you're talking about for example.itsme86
I didn't talk about the dll becuase it is provided by a manufacturer of a device. But, I will edit the post to include the dll. Could you recommend any other changes as I am -3?codingDude
run fuslogvw - it will show you where clr tried looking for the DLLpm100
Have you tried forcing x64? the default mode for a C# debug mode program is x32 I believe.Marc Bernier

1 Answers

3
votes

I apologize for not posting an update to this question!

I eventually figured out the issue. It would appear the I was using a 64-bit version of the dll for a 32-bit application. Once I loaded in the 32-bit version of the dll, I was able to compile without any issue!