katie1245
katie1245

Reputation: 1137

Why Visual C++ Redistributables needed?

I'm installing GTA 5 and it's also installed Visual C++ Redistributables. This got me curious about something, because this happens a lot.

As far as I know, these are needed for linking to VC++ libraries, but I already have .NET 4.8 installed on my system.

I thought when C++ (managed) gets compiled to MSIL, it would then just use the standard .NET Framework libraries.

So essentially the question is, since the .NET Framework libraries are present, why do additional VC++ specific libraries also need to be installed?

Thanks!

Upvotes: 3

Views: 2865

Answers (2)

selbie
selbie

Reputation: 104559

Simple answer:

".NET runtime" is to C# as "Visual C++ runtime" is to C++

Explanation:

Applications written in C# or "managed code" require a specific version of the .NET runtime installed. The .NET runtime not only includes the interpreter for the virtual machine code, but also provides all the standard class libraries an application developer might reference in his code. Applications written in C# will need the .NET runtime installed on the target computer.

Applications written in C/C++ or a "native code" typically link with a set of libraries to provide the common set of functions and classes provided by the language standard (e.g. printf and std::string). The application developer can choose to statically link these functions directly into his EXE. But it's often advantageous to link dynamically with a DLL version of these libraries so they can be shared across the system or with binaries within the application. Hence, the redistributable package.

Upvotes: 3

dxiv
dxiv

Reputation: 17648

C++ compiles to native code and does not use the .NET runtimes. It uses the VC++ runtime (*), which can be either statically or dynamically linked. In the latter cases, this requires the VC++ redistributables.

(*) It is technically possible to build an application with VC++ that does not use the VC++ runtime at all, but that sacrifices language features and is not common.

Managed flavors such as C++/CLI compile to mixed mode assemblies, which still have an unmanaged part with the same requirements.

Upvotes: 2

Related Questions