来自HRESULT的异常:0x8007007E

时间:2017-08-08 09:56:04

标签: c# dllimport

我正在尝试在我的dll代码中添加一个不受管理的c#。当我运行代码时,我发现dll未找到异常。我的代码还需要什么来调试此错误?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;


    namespace FPGA_DLL
    {
         class Program
        {


             const string DllPath = "C:\\Users\\testuser\\Desktop\\Dip\\ConsoleApplication1\\mcp2210_dll_um_x86.dll";


            /* API for getting access to the USB device */      
            [DllImport(DllPath, EntryPoint = "Mcp2210_GetConnectedDevCount", CallingConvention = CallingConvention.StdCall)]
            public static extern int Mcp2210_GetConnectedDevCount(ushort vid, ushort pid);



            static void Main(string[] args)
            {
                const ushort MCP2210_VID = 0x04D8;   // VID for MCP2210
                const ushort MCP2210_PID = 0x00DE;   // PID for MCP2210

                int devCount = Mcp2210_GetConnectedDevCount(MCP2210_VID, MCP2210_PID);
                Console.WriteLine(devCount);

            }
        }
    }

异常详情 无法加载DLL

  

'C:\用户\ TESTUSER \桌面\浸\ ConsoleApplication1 \ mcp2210_dll_um_x86.dll':   指定的模块无法找到。 (HRESULT的例外情况:   0x8007007E)

0 个答案:

没有答案