Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem loading DLL

Posted on 2007-03-29
4
Medium Priority
?
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 450 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 1050 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

715 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