C# dll calling a c++ dll cannot find the dll on windows 10


i created a c# dll which call a c++ dll. For this am am doing a simple DLLimport. This worked fine on all of my Windows 7 machines but now i tried to run it on a Windows 10.. When executing a c# function then i get an error that the called c++ dll cannot be found. (System.DllNotFoundException).

The c# and c++ dll are in the same directory. I tried to copy both files to the exe file that calls the c# library ->no luck

I tried to copy both files to system32 -> no luck.

Where do i have to copy them so that c# "sees" the c++ dll? Any way to tell windows where to search?

Thanks for help

Edit: The C# and C++ dll are developed with "Visual Studio Express 2015". On the windows 10 system i installed Microsoft Visual C++ 1010/2012/2013/2015 Redistributable x86/x64 The exception is: An exception occurred inside the call to .NET member 'function_Cs': System.DllNotFoundException: Die DLL "The_C++_library.dll": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden. bei C#library.C#library.function(Int32 a, Int32 b, Int32& res)

asked on Stack Overflow Feb 4, 2019 by Markus.H1 • edited Feb 4, 2019 by Markus.H1

2 Answers


The problem is not that the C++ DLL is in the wrong place; the problem is that it cannot be loaded. Most likely it depends on a version of the Microsoft C++ Runtime Library that is not available by default on Windows 10. You can verify this by checking the status of dependent DLLs via Dependency Walker. You can either:

answered on Stack Overflow Feb 4, 2019 by Dark Falcon

After recompiling the sources (without changing anything) the dll can be executed without problems. Strange, but this was the solution. The not working dll was ~6 month old and worked on other Windows 7 computers.

answered on Stack Overflow Feb 5, 2019 by Markus.H1

User contributions licensed under CC BY-SA 3.0