none
Unable to load DLL,How do i fix this error? RRS feed

  • Question

  • Hi,I have an application where i am using this dll. but on running the application i am getting the following exception. Can anybody help me on how to fix this please? I am using visual studio 2012 RC on windows 8 64-bit.

    Unable to load DLL 'CpcpLib.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)


    Thanks and Regards, Prashanth MP.


    • Edited by JohnnyWalker9 Friday, November 9, 2012 10:32 AM
    • Moved by Sheldon _Xiao Tuesday, November 13, 2012 7:37 AM (From:Windows Presentation Foundation (WPF))
    Thursday, November 8, 2012 1:00 PM

Answers

  • It's kind of hard to give a concrete answer without better understanding the problem.  Regardless, here's some thoughts:

    1. Is cpcplib.dll in the same folder of the EXE, or in the path?
    2. can cpcplib.dll be loaded (try calling Assembly.LoadFile for .NET assembly or SDK method LoadLibrary for anything else)?
    3. The method you're trying to call....did you spell it right, including case (depending on how its built case can make a difference)?  If you are using interop, make your your DllImport attribute is correctly applied.

    Here's an example of Assembly.LoadFile

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Reflection;
    using System.IO;
    
    namespace AssemblyLoad
    {
        class Program
        {
            static void Main(string[] args)
            {
                if ((null == args) || (0 == args.Length))
                {
                    Console.WriteLine("Nothing to do, need file name");
                    return;
                }
    
                string fileName = args[0];
    
                try
                {
                    string path = Path.GetFullPath(fileName);
                    Assembly assembly = Assembly.LoadFile(path);
                    Console.WriteLine("{0} loaded.", fileName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(string.Format("Errors on {1}: {0}", ex.Message, fileName));
                }
            }
        }
    }
    

    Matt

    Thursday, November 8, 2012 11:16 PM