microsoft/cpp_client_telemetry

Cannot link win10-lib into C++/WinRt Runtime component

pablo-msft opened this issue · 0 comments

Similar to microsoft/cppwinrt#1053

  1. Build zlib, sqlite-uwp, win10-lib
  2. Create a new C++/WinRT Windows Runtime component
    image
  3. Include LogManager.hpp (no need to write any code)
  4. Link zlib.lib, sqlite-uwp.lib, Microsoft.Applications.Telemetry.Windows.native.lib
  5. Build C++/WinRT DLL
  6. Build errors:

1>vccorlibd.lib(init.obj) : error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker': value '1' doesn't match value '0' in MSVCRTD.lib(app_appinit.obj)
1>vccorlibd.lib(init.obj) : error LNK2005: __crtWinrtInitType already defined in MSVCRTD.lib(app_appinit.obj)

Resolution: https://stackoverflow.com/questions/34939913/mismatch-detected-for-vccorlib-lib-should-be-specified-before-msvcrt-lib-to-lin

Many repetitions of:

1>Microsoft.Applications.Telemetry.Windows.native.lib(capi.obj) : warning LNK4197: export 'DllGetActivationFactory' specified multiple times; using first specification
1>Microsoft.Applications.Telemetry.Windows.native.lib(capi.obj) : warning LNK4197: export 'DllCanUnloadNow' specified multiple times; using first specification

This seems to be due to vccorlib and C++/CX dependencies used in win10-lib. See: https://stackoverflow.com/questions/12893355/windowsstorageapplicationdatacurrent-not-found-in-c

Expected behavior: we ought to be able to link the static cpp_client_telemetry lib into our WinRT DLL without conflicts. Then we can distribute just the WinRT DLL with cpp_client_telemetry built into it.