microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.11k stars 6.37k forks source link

Cannot use gettext in UWP application #16801

Closed levinli303 closed 3 years ago

levinli303 commented 3 years ago

Describe the bug When I try to use gettext in a UWP application, the application failed to start.

Environment

To Reproduce Steps to reproduce the behavior:

  1. ./vcpkg install gettext:x64-uwp
  2. Create a new project, UWP app, C++/CX
  3. include and use gettext somewhere in code

  4. Build and run

Expected behavior Should run without any issue.

Failure logs The target process aborted before activation completed. The program '[1064] GettextTest.exe' has exited with code -1073741502 (0xc0000142) 'DLL Initialization Failed'.

Additional context intl-8.dll iconv-2.dll ucrtbased.dll are present in the .exe folder.

JackBoosY commented 3 years ago

Confirmed. But maybe the upstream doesn't supoort uwp.

levinli303 commented 3 years ago

I tried to use libiconv only and it led to the same error.

levinli303 commented 3 years ago

@JackBoosY I tested with the commit before #11776 is merged and it was working.

levinli303 commented 3 years ago

@JackBoosY

I could see that in libiconv, it used GetModuleFileName to get the path and then used strchr to find the path separator. GetModuleFileName mapped to GetModuleFileNameW but strchr is ANSI, which caused the failure in DLL initialization