Click here to Skip to main content
16,021,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
[DllImport("DriveLibrary.dll",  CallingConvention = CallingConvention.Cdecl, EntryPoint = "createClass")]


public static extern void createClass();
public void _createClass()
{
    try
    {
         createClass();
          debug("_createClass");
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}


What I have tried:

I try my best to Solve this error But I Cant. Please Anyone can Help Me???
Posted
Updated 19-Apr-16 1:31am
Comments
Garth J Lancaster 19-Apr-16 7:25am    
how did you try to solve it ? where is 'DriveLibrary.dll' in relation to the exe ?
Member 10958630 19-Apr-16 8:50am    
DriveLibrary.dll is in the Debug folder
Member 10958630 20-Apr-16 0:19am    
yes dll is in the debug folder

1 solution

The error message is quite clear:
The DLL file could not be found in one of the directories that are searched (see Dynamic-Link Library Search Order (Windows)[^]).

So copy the file to one of these directories or specify the full name with path.

[EDIT]
The error may be also thrown when dependencies can not be found (the DLL requires loading other DLLs). You may use the Dependency Walker (depends.exe) Home Page[^] to check this.
[/EDIT]
 
Share this answer
 
v2
Comments
Member 10958630 19-Apr-16 7:34am    
tried but not working
Jochen Arndt 19-Apr-16 7:51am    
The DLL itself may have dependencies (requires to load other DLLs). If such a DLL can't be found, the error will be also thrown.

You might use the Dependency Walker (http://www.dependencywalker.com/) to check the dependencies. I will update my solution.
Member 10958630 19-Apr-16 8:51am    
Tried Dependencywalker but Not working
Jochen Arndt 19-Apr-16 8:59am    
What did you tried?

Load your application or the DLL with the Dependency Walker and check if all dependencies can be resolved.
Member 10958630 19-Apr-16 9:08am    
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

Dependency Walker Error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900