[m-rev.] for review: unicode command line arguments on windows

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Dec 15 16:46:22 AEDT 2011


On Thu, 15 Dec 2011, Peter Wang wrote:

> On Thu, 15 Dec 2011 16:07:34 +1100 (EST), Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>>
>>> Can you test this on MSVC?
>>
>> Ok, for any executable that is not the compiler, e.g mslice.exe,
>> mercury_profile.exe, we get the following error:
>>
>> error LNK2019: unresolved external symbol __wgetmainargs referenced in
>> function _mercury_win32_args
>>
>> Is __wgetmainargs included in the static version of the library on
>> Windows, i.e. in libcmt.lib?  Or is only part of the dynamic library?
>> (MSDN is its unsual unhelpful self on this issue.)
>
> I guess?
> http://code.google.com/p/msysgit/source/detail?r=43adf7bb24&repo=4msysgit

Unfortunately it didn't help much :-(

mslice_init.obj : error LNK2019: unresolved external symbol
__imp__CommandLineToArgvW at 8 reference in function _mercury_win32_args

> For MSVC we have the option of using
>    wmain(int argc, wchar_t *argv[], wchar_t *envp[])

Perhaps the best thing to do is just

   #if defined(MR_MSVC)
      wmain(...)
   #else
      main(...) + call mercury_win32_args on argv in this case
   #endif

(It looks as though mingw-gcc doesn't support wmain.)

>> I will try reconfuring with --with-msvcrt enabled and see if that helps.
>> In the meantime, This is all rather curious, because mercury_compile.exe
>> does build (and indeed runs).  Any idea what we might be doing
>> differently in the compiler directory?
>
> The compiler uses main.c and not the output of mkinit.

Oh yes, I was forgetting that --no-main means that the call to
mercury_win32_args will be dead code in that case.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list