Solved

Problem loading DLL

Posted on 2007-03-29
4
556 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now