25

Steve tells me that VC 2015 and VC 2017 are actually (gonna be) binary compatible.

I found zero info wrt. this in the release notes for 2017 (RC) - or pretty much anywhere for that matter, so here goes:

  • Is a C++ (C++ interface) DLL built with VC++-2017 binary compatible with a DLL built by VC++-2015?
  • Do 2017 and 2015 use the same (dynamic) runtime library?
  • If so, what, if any, is the runtime difference between Platform Toolset Visual Studio 2017 (v141) and Visual Studio 2015 (v140)? (*)

(*): Yeah, I actually went ahead and installed the 2017 RC, and from what I can see on the surface, at least the identical MSVCRT is used, that is msvcp140.dll and vcruntime140.dll (despite the platform toolset being called "v141".

Martin Ba
  • 37,187
  • 33
  • 183
  • 337
  • MS has since added an "official" blurb: https://learn.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017 – Martin Ba Nov 07 '18 at 09:25

3 Answers3

21

Yes, the 141 and 140 libraries are almost identical. The version was bumped for a side-by-side issue. The v140 toolset in VisualC++ 2015 and v141 toolset in VC++ 2017 are binary compatible.

Manjunath
  • 491
  • 2
  • 6
  • 17
apardoe
  • 631
  • 6
  • 10
  • 1
    Is this still the case for VS2017 15.3? We're getting linker errors ("different compiler version") with 2015 static libs now. – Kevin Richardson Aug 24 '17 at 18:36
  • I'm unable to install **VC++2015Redist** on a machine that has **VC++2017Redist** https://stackoverflow.com/questions/45967479/can-visual-c-2017-redistributable-package-support-the-applications-that-use-vc – Manjunath Aug 30 '17 at 18:40
  • 4
    Kevin, are you using libraries compiled with /GL (link-time codegen)? Those are not supported across major compiler versions. They worked with 15.0-15.2, but that was just dumb luck. – apardoe Sep 09 '17 at 19:53
  • @KevinRichardson Maybe this is supposed to work, but you're hitting the following bug? I'm getting this error myself: https://developercommunity.visualstudio.com/content/problem/112448/link-failure-with-vs2015-static-library-and-vs2017.html – Scott Langham Sep 15 '17 at 12:24
  • 1
    Yes, we recently talked to Microsoft and it was the /GL issue. – Kevin Richardson Sep 15 '17 at 15:45
  • To clarify @apardoe comment which points to the root of the issue, /GL (link-time codegen) is misleading. In VS project settings, /GL is associated with "Whole Program Optimization", so look for that to disable. LTCG is implied with /GL however. https://learn.microsoft.com/en-us/cpp/build/reference/ltcg-link-time-code-generation?view=vs-2017 – solvingJ Sep 06 '18 at 00:59
  • @apardoe - Hi Andrew. Maybe you would like to take a look at https://stackoverflow.com/questions/53187152/is-the-official-binary-incompatibility-between-vs2017-and-vs2015-app-vs-dll-acc ... official docs confuse me some. – Martin Ba Nov 07 '18 at 10:04
1

Microsoft has been updating their CRT in an incremental manner.

Visual C++ 14.0 (2015) CRT has 4 files:

  • vcruntime140.dll (C Runtime; from refactored msvcr*.dll)
  • concrt140.dll (the Concurrency Runtime; also from msvcr*.dll)
  • msvcp140.dll (C++ Runtime)
  • vccorlib140.dll (C++/CX Platform::*)

Visual C++ 14.1 (2017) CRT adds only 2 files:

Visual C++ 14.2 (2019) CRT adds only 2 files:

If some of the additional features listed above are not used, the binary can work with older versions of C Runtime.

dolly17107
  • 136
  • 1
  • 6
  • 1
    Note that ``msvcp140_2.dll`` is actually in VS 2017 (added in an update), and ``vcruntime140_1.dll`` was added in VS 2019 to support a new x64 exception handling implementation (see [this blog post](https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/)). Note that ``concrt140.dll`` is only used for Windows XP platform support for ````; it's not used on newer versions of Windows. – Chuck Walbourn Jun 16 '20 at 19:35
1

Yes, visual 2019(14.2),2017(14.1),2015(14.0) are all binary compatible, they are all 14.x version. See more on https://learn.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017. New versions add some new features or patches.

The following are the files in 2017 and 2019, you can find the new files added in 2019.


C:\Users\Liu.D.H>dir "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.16.27012\x64\Microsoft.VC141.CRT"
 Volume in drive C is System
 Volume Serial Number is 0CAC-076E

 Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.16.27012\x64\Microsoft.VC141.CRT

2020-09-25  14:41    <DIR>          .
2020-09-25  14:41    <DIR>          ..
2020-09-25  14:41           332,568 concrt140.dll
2020-09-25  14:41           627,992 msvcp140.dll
2020-09-25  14:41            31,512 msvcp140_1.dll
2020-09-25  14:41           206,104 msvcp140_2.dll
2020-09-25  14:41           366,872 vccorlib140.dll
2020-09-25  14:41            85,784 vcruntime140.dll
               6 File(s)      1,650,832 bytes
               2 Dir(s)  57,822,343,168 bytes free

C:\Users\Liu.D.H>dir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.27.29016\x64\Microsoft.VC142.CRT"
 Volume in drive C is System
 Volume Serial Number is 0CAC-076E

 Directory of C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.27.29016\x64\Microsoft.VC142.CRT

2020-09-25  13:07    <DIR>          .
2020-09-25  13:07    <DIR>          ..
2020-09-25  13:07           317,224 concrt140.dll
2020-09-25  13:07           590,632 msvcp140.dll
2020-09-25  13:07            31,528 msvcp140_1.dll
2020-09-25  13:07           193,832 msvcp140_2.dll
2020-09-25  13:07            27,936 msvcp140_codecvt_ids.dll
2020-09-25  13:07           337,696 vccorlib140.dll
2020-09-25  13:07           101,672 vcruntime140.dll
2020-09-25  13:07            44,328 vcruntime140_1.dll
               8 File(s)      1,644,848 bytes
               2 Dir(s)  57,822,343,168 bytes free

C:\Users\Liu.D.H>

Because I can't install 2015 files. I extract it (D:\apps\wix311-binaries\dark.exe -nologo -x "D:\tmp\vcredist_x64-2015" "C:\Users\Liu.D.H\Downloads\vc_redist.x64-2015.exe") and you can find the files below.

liudonghua@desktop-ldh:/mnt/d/tmp/vcredist_x64-2015$ /usr/bin/tree .
.
├── AttachedContainer
│   └── packages
│       ├── Patch
│       │   ├── x64
│       │   │   ├── Windows6.0-KB2999226-x64.msu
│       │   │   ├── Windows6.1-KB2999226-x64.msu
│       │   │   ├── Windows8-RT-KB2999226-x64.msu
│       │   │   └── Windows8.1-KB2999226-x64.msu
│       │   └── x86
│       │       ├── Windows6.0-KB2999226-x86.msu
│       │       ├── Windows6.1-KB2999226-x86.msu
│       │       ├── Windows8-RT-KB2999226-x86.msu
│       │       └── Windows8.1-KB2999226-x86.msu
│       ├── vcRuntimeAdditional_amd64
│       │   ├── cab1
│       │   │   ├── mfc140.dll
│       │   │   ├── mfc140chs.dll
│       │   │   ├── mfc140cht.dll
│       │   │   ├── mfc140deu.dll
│       │   │   ├── mfc140enu.dll
│       │   │   ├── mfc140esn.dll
│       │   │   ├── mfc140fra.dll
│       │   │   ├── mfc140ita.dll
│       │   │   ├── mfc140jpn.dll
│       │   │   ├── mfc140kor.dll
│       │   │   ├── mfc140rus.dll
│       │   │   ├── mfc140u.dll
│       │   │   ├── mfcm140.dll
│       │   │   └── mfcm140u.dll
│       │   ├── cab1.cab
│       │   └── vc_runtimeAdditional_x64.msi
│       └── vcRuntimeMinimum_amd64
│           ├── cab1
│           │   ├── api_ms_win_core_console_l1_1_0.dll
│           │   ├── api_ms_win_core_datetime_l1_1_0.dll
│           │   ├── api_ms_win_core_debug_l1_1_0.dll
│           │   ├── api_ms_win_core_errorhandling_l1_1_0.dll
│           │   ├── api_ms_win_core_file_l1_1_0.dll
│           │   ├── api_ms_win_core_file_l1_2_0.dll
│           │   ├── api_ms_win_core_file_l2_1_0.dll
│           │   ├── api_ms_win_core_handle_l1_1_0.dll
│           │   ├── api_ms_win_core_heap_l1_1_0.dll
│           │   ├── api_ms_win_core_interlocked_l1_1_0.dll
│           │   ├── api_ms_win_core_libraryloader_l1_1_0.dll
│           │   ├── api_ms_win_core_localization_l1_2_0.dll
│           │   ├── api_ms_win_core_memory_l1_1_0.dll
│           │   ├── api_ms_win_core_namedpipe_l1_1_0.dll
│           │   ├── api_ms_win_core_processenvironment_l1_1_0.dll
│           │   ├── api_ms_win_core_processthreads_l1_1_0.dll
│           │   ├── api_ms_win_core_processthreads_l1_1_1.dll
│           │   ├── api_ms_win_core_profile_l1_1_0.dll
│           │   ├── api_ms_win_core_rtlsupport_l1_1_0.dll
│           │   ├── api_ms_win_core_string_l1_1_0.dll
│           │   ├── api_ms_win_core_synch_l1_1_0.dll
│           │   ├── api_ms_win_core_synch_l1_2_0.dll
│           │   ├── api_ms_win_core_sysinfo_l1_1_0.dll
│           │   ├── api_ms_win_core_timezone_l1_1_0.dll
│           │   ├── api_ms_win_core_util_l1_1_0.dll
│           │   ├── api_ms_win_crt_conio_l1_1_0.dll
│           │   ├── api_ms_win_crt_convert_l1_1_0.dll
│           │   ├── api_ms_win_crt_environment_l1_1_0.dll
│           │   ├── api_ms_win_crt_filesystem_l1_1_0.dll
│           │   ├── api_ms_win_crt_heap_l1_1_0.dll
│           │   ├── api_ms_win_crt_locale_l1_1_0.dll
│           │   ├── api_ms_win_crt_math_l1_1_0.dll
│           │   ├── api_ms_win_crt_multibyte_l1_1_0.dll
│           │   ├── api_ms_win_crt_private_l1_1_0.dll
│           │   ├── api_ms_win_crt_process_l1_1_0.dll
│           │   ├── api_ms_win_crt_runtime_l1_1_0.dll
│           │   ├── api_ms_win_crt_stdio_l1_1_0.dll
│           │   ├── api_ms_win_crt_string_l1_1_0.dll
│           │   ├── api_ms_win_crt_time_l1_1_0.dll
│           │   ├── api_ms_win_crt_utility_l1_1_0.dll
│           │   ├── concrt140.dll
│           │   ├── msvcp140.dll
│           │   ├── ucrtbase.dll
│           │   ├── vcamp140.dll
│           │   ├── vccorlib140.dll
│           │   ├── vcomp140.dll
│           │   └── vcruntime140.dll
│           ├── cab1.cab
│           └── vc_runtimeMinimum_x64.msi
└── UX
    ├── 1028
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1029
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1031
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1036
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1040
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1041
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1042
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1045
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1046
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1049
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 1055
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 2052
    │   ├── license.rtf
    │   └── thm.wxl
    ├── 3082
    │   ├── license.rtf
    │   └── thm.wxl
    ├── BootstrapperApplicationData.xml
    ├── license.rtf
    ├── logo.png
    ├── manifest.xml
    ├── thm.wxl
    ├── thm.xml
    └── wixstdba.dll

23 directories, 106 files
liudonghua@desktop-ldh:/mnt/d/tmp/vcredist_x64-2015$

The main files in 2015 are the following.

│           │   ├── concrt140.dll
│           │   ├── msvcp140.dll
│           │   ├── ucrtbase.dll
│           │   ├── vcamp140.dll
│           │   ├── vccorlib140.dll
│           │   ├── vcomp140.dll
│           │   └── vcruntime140.dll
Donghua Liu
  • 1,776
  • 2
  • 21
  • 30