Skip to content

Instantly share code, notes, and snippets.

@poizan42
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poizan42/3fba0804c76b97baae66 to your computer and use it in GitHub Desktop.
Save poizan42/3fba0804c76b97baae66 to your computer and use it in GitHub Desktop.
stub to call wmain from main
#include <string>
#include <codecvt>
#include <locale>
int main(int argc, const char *argv[])
{
std::wstring_convert < std::codecvt<wchar_t, char, std::mbstate_t> > conv;
std::vector<const wchar_t*> wargv;
std::vector<std::wstring> wsargv;
wargv.resize(argc);
wsargv.resize(argc);
for (int i = 0; i < argc; i++)
{
wsargv[i] = conv.from_bytes(argv[i]);
wargv[i] = wsargv[i].c_str();
}
return wmain(argc, wargv.data());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment