14#include "../Encoding.hpp"
26#if !(defined(_AMD64_) || defined(_X86_) || defined(_ARM_))
27#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || \
30#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__i386__) || defined(_M_IX86)
32#elif defined(__arm__) || defined(_M_ARM) || defined(_M_ARMT)
34#elif defined(__aarch64__) || defined(_M_ARM64)
36#elif defined(_M_ARM64EC)
54#include <processthreadsapi.h>
65CLI11_INLINE std::vector<std::string> compute_win32_argv() {
66 std::vector<std::string> result;
69 auto deleter = [](
wchar_t **ptr) { LocalFree(ptr); };
71 auto wargv = std::unique_ptr<wchar_t *[], decltype(deleter)>(CommandLineToArgvW(GetCommandLineW(), &argc), deleter);
74 if(wargv ==
nullptr) {
75 throw std::runtime_error(
"CommandLineToArgvW failed with code " + std::to_string(GetLastError()));
78 result.reserve(
static_cast<size_t>(argc));
79 for(
size_t i = 0; i < static_cast<size_t>(argc); ++i) {
80 result.push_back(narrow(wargv[i]));