Solved

Problem loading DLL

Posted on 2007-03-29
4
558 Views
Last Modified: 2012-06-21
I have a C# program that loads another DLL:

    [DllImport("Test.dll", EntryPoint = "Start")]
    public unsafe static extern void TestStart();

Test.dll is written in C++ and contains an "empty" function that does nothing:

    extern "C" __declspec(dllexport) void Start();

The program runs fine on multiple Windows machines, including a Windows 2000 desktop. However, when I tried executing this program on this Windows 2000 laptop, it throws the following exception:

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

Additional Information:

    - .NET Framework 1.1/2.0 are installed on the Windows 2000 laptop.
    - All executables are run from local hard disk.
    - The C# program is compiled with Visual Studio 2005.
    - Test.dll is compiled with Visual Studio 2003.

Anyone knows why this program wouldn't run on the laptop?

Thanks!
0
Comment
Question by:james567
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 150 total points
ID: 18822087
I cant think of any reason why it wouldnt run on a laptop.  Is the test.dll put in the correct directory so that the refernce is right?  Does it reference anything that would be missing?   Just go through the code making sure that test.dll has nothing missing from its references, and check that it is where it is meant to be for your main project to find it.

I hope this helps
0
 

Author Comment

by:james567
ID: 18825337
Test.dll is a simplified test case so it does not reference anything. It's placed in the same directory as the C# executable. The same configuration worked on other machines but just not this laptop.

In fact, another C# program that loads a C++ DLL also failed to execute on that machine. It looks like the C# program on that machine is not able to load any C++ DLLs. It can, however, load DLLs written in C# without problems.

Trust level for assemblies located on local disk is set to full trust.

Regards,

James
0
 
LVL 1

Accepted Solution

by:
Manjesh earned 350 total points
ID: 18937346
0x8007007E = The specified module could not be found

Try providing the abolute path
[DllImport ("c:\\temp\\Test.dll", CharSet=CharSet.Unicode)]

If possible run the DLL Dependecy walker for Test.dll

A person has also faced the similar problem,  go throught the below link, he has built the dll using BC++.

http://groups.google.com/group/microsoft.public.dotnet.framework.sdk/browse_thread/thread/48dec66aedf46576/9e517c5bb64a705d?lnk=st&q=DllImport+0x8007007E&rnum=1#9e517c5bb64a705d

0
 

Author Comment

by:james567
ID: 18969179
I'm sorry. I was told that one of my colleagues was able to execute the program on her Windows 2000 machine, but in fact the machine was a Windows XP with the old style GUI...

What happened was that Windows 2000 didn't have the required MFC DLLs.

Thanks.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question