Ann
Ann

Reputation: 35

Visual C++ Creating DLL missing dependencies

I just created a C++ DLL using Visual Studio 2015. I did no edits to the default source. Then I used DependencyWalker to see all my DLL dependencies and I saw this:

this

You can clearly see that most of the dll required are missing.

When I try to connect to such a dll I get error for those libaries missing...

I tried connecting to a DLL made in CodeBlocks and it didn't give me any errors.

Whats going on ?

PS:

Here is the error message:

The program can't start because MSVCP140_APP.dll is missing from your computer.Try reinstalling the program to fix the problem.

More information of my problem can be seen here:

Upvotes: 2

Views: 3696

Answers (1)

Drop
Drop

Reputation: 13013

You question consists of two parts.

Part one

You can clearly see that most of the dll required are missing.

api-ms-win-* family of modules, introduced with Windows 7, consists of tiny stub DLLs that redirect function calls inside core libraries (such as kernel32, user32 etc.) to their implementations elsewhere.

They are not really missing, it's just Dependency Walker is ridiculously out of date (latest version dates back to year 2006) and doesn't know where to search. In fact, you can inspect any successfully running windows binary that links to system libraries and see the very same picture.

api-ms-win-* it's an internal details of Windows implementation and you shouldn't worry about it, unless you are working at Microsoft in Windows kernel team.

Part two

When I try to connect to such a dll I get error for those libaries missing... I tried connecting to a DLL made in CodeBlocks and it didn't give me any errors.

Visual C++ -> DLL (Universal Windows)
Visual C++ -> Win32 Project

You are mixing Win32 application (uses good 'ol Win32 API) and Universal Windows Platform libary (that what was Windows RT before).

Instead you should either:

  • (the Win32 way) create a usual Win32 DLL, by using Visual C++ -> Win32 Project template and then choosing Application type: DLL and then link it with your Win32 App.

  • (the WinRT way) create a Universal Windows App to link against Universal Windows DLL

Code blocks works here because it does not (and will probably never) support UWP.

P.S. You should never explicitly link against VCRUNTIME140_APP.dll or worse api-ms-win-*.dll unless you know what you are dong.

P.P.S. To be completely honest, you can mix UWP and Win32 in a limited way. But let's call it an advanced topic and leave it as an exercise to a curious reader.

Links:

Upvotes: 4

Related Questions