简体   繁体   中英

How do I link to external DLL so that it will be recognized by Windows 8.1?

I developed WindowsForm application using C# with Visual Studio 2010, and I have external DLL (written using VC++). When I deployed it to Windows 7, everything works fine. However, on Windows 8.1, it installed fine and run fine, until the program needed to access the library function inside the DLL. It complained that it couldn't find the DLL (even though the file is in the same location as the executable).

This happened in Windows 8.1 only (perhaps with Windows 8 as well).

Did I link the DLL incorrectly perhaps?

Assuming that your DLL is a windows native DLL, one of two things is happening:

  1. Windows is failing to locate the DLL
  2. The DLL has other dependencies that are not available on the machine

To check, try changing the PATH environment variable to include the folder that your DLL is in. If the program runs then it's a problem with locating the DLL.

If that doesn't work then you'll need to do some more in-depth investigation to find out what is actually happening.

There's a guide here that shows you how to determine what is happening with your program using Process Monitor to find out what is actually failing to load. This might not be your C++ DLL, it could be one of the many dependencies for it.

The answer is the comment from Harry Johnston above:

Most likely cause: the Visual Studio 2010 Microsoft C runtime isn't installed on the Windows 8.1 machine. Or perhaps the C++ class library. Nothing to do with the OS version, except perhaps indirectly. You can diagnose this sort of problem using Process Monitor, look for file not found errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM