fix build issue on MSVC14

This commit is contained in:
nu774 2015-07-22 21:55:19 +09:00
parent 4080ab21e6
commit e403976bf6
1 changed files with 6 additions and 1 deletions

View File

@ -97,11 +97,16 @@ void aacenc_free_mainargs(void)
void aacenc_getmainargs(int *argc, char ***argv)
{
static int (*fp__wgetmainargs)(int *, wchar_t ***, wchar_t ***,
int, _startupinfo *);
int i;
wchar_t **wargv, **envp;
_startupinfo si = { 0 };
HMODULE h = LoadLibraryA("msvcrt.dll");
fp__wgetmainargs = (void *)GetProcAddress(h, "__wgetmainargs");
(*fp__wgetmainargs)(argc, &wargv, &envp, 1, &si);
FreeLibrary(h);
__wgetmainargs(argc, &wargv, &envp, 1, &si);
*argv = malloc((*argc + 1) * sizeof(char*));
for (i = 0; i < *argc; ++i)
codepage_encode_wchar(CP_UTF8, wargv[i], &(*argv)[i]);