|
-
Nov 17th, 2005, 07:33 PM
#1
Thread Starter
New Member
[RESOLVED] unable to load unmanaged dll
I have code to call a DLL that I wrote in C (see end of message). This code has worked fine for months. I reloaded my OS and installed a fresh vs2005 rc and now I'm getting a System.DllNotFoundException. It also says: Unable to load DLL 'copy.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
My DLL is in my working directory just as it was before. My project setup has not changed and the working directory is specified correctly. What could have changed to cause this error?
Code:
[DllImport( "copy.dll", CharSet = CharSet.Unicode )]
public static extern int BackupClose( long hash1, long hash2 );
-
Nov 17th, 2005, 10:03 PM
#2
Fanatic Member
Re: unable to load unmanaged dll
i guess its your file system has change.
Last edited by popskie; Nov 17th, 2005 at 10:08 PM.
-
Nov 17th, 2005, 10:18 PM
#3
Re: unable to load unmanaged dll
According to MSDN,
If you provide no path, the DLL must be in the current path at run time
But if as you say the working directory is specificed correctly, then I'm not sure why it doesn't work. You may need to try putting it in the \System32 folder.
-
Nov 18th, 2005, 12:36 AM
#4
Thread Starter
New Member
Re: unable to load unmanaged dll
I tried putting a copy everywhere I could think of, including system32.
This is extremely frustrating.
-
Nov 18th, 2005, 12:06 PM
#5
Frenzied Member
Re: unable to load unmanaged dll
Does copy.dll reference any other dlls that may have been removed when you reinstalled your OS? If you wrote that dll you probably know, you can also use dependency walker (depends.exe) to check it out.
Mike
-
Nov 18th, 2005, 04:46 PM
#6
Thread Starter
New Member
Re: unable to load unmanaged dll
Thanks mucho! Depends.exe showed my problem immediately.
I was surprised to find that my dll depended on another dll. I have no code to load a dll. My link setup referred to a xxx.lib file, which I thought would cause it to link in the code instead of requiring a runtime dll. I didn't even know xxx had a dll. Does this mean that the lib I linked in had a reference to a dll? If so, how was I supposed to know this?
I have been programming C for a number of years and I thought I understood it all (big mistake).
-
Nov 18th, 2005, 04:50 PM
#7
Thread Starter
New Member
Re: unable to load unmanaged dll
By the way, I posted this problem on a number of C# discussion boards and I got no help anywhere else and a lot of help here. I think I'll hang out here more often.
-
Nov 18th, 2005, 04:52 PM
#8
Re: unable to load unmanaged dll
Welcome to the forums 
If your problem is solved you can let others know by selecting "Mark Thread Resolved" from the "Thread Tools" menu above the 1st post
-
Apr 26th, 2006, 07:54 PM
#9
New Member
Re: [RESOLVED] unable to load unmanaged dll
Hello All
I am experiencing similar problem with one of my un-managed C++ DLL.
This was working fine in Visual Studio 2003 version but gives following error in Visual Studio 2005
Unable to load DLL 'xxxx.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I read on this post something related to dependency.
When i look at the dependency for this it showed system32\Kernel32.dll and system32\OLeAUTO32.dll
I am calling my DLL from the web page using DLLImport.
Do i have to reference these system DLLs in my Web Project to make DLLImport call work again ??
Appreciate any help
Cheers
-
Apr 26th, 2006, 07:56 PM
#10
New Member
Re: unable to load unmanaged dll
 Originally Posted by mchahn
By the way, I posted this problem on a number of C# discussion boards and I got no help anywhere else and a lot of help here. I think I'll hang out here more often.
Please see my post at the end
Thanks
-
Apr 24th, 2007, 10:34 AM
#11
New Member
Re: [RESOLVED] unable to load unmanaged dll
Hi guys,
I am facing same problem. can anybody help me?
Will i needed to add all depended DLLs as a ref? Both Main DLL and depended DLLs should be on same folder?
Will i need to register dll with REGSVR32.EXE?
Thanks,
Jagdish
-
May 3rd, 2007, 10:07 AM
#12
New Member
Re: [RESOLVED] unable to load unmanaged dll
Update the system PATH variable to point to the bin folder where the DLL reside. That should fix it
Good Luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|