Link to home
Start Free TrialLog in
Avatar of james567
james567

asked on

Problem loading DLL

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!
SOLUTION
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of james567
james567

ASKER

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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.