Solved

Problem loading DLL

Posted on 2007-03-29
4
557 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
coded character set iptc field within a jpeg 1 67
Excel file not created as expected 7 46
Word Directory is not in the drop down list 4 24
Host asp.net pages 5 25
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…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 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

17 Experts available now in Live!

Get 1:1 Help Now