lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

The CRT source code comes with Visual Studio (probably not with the Express Edition). One can download the VS2011 Preview and in it, just check the

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\stdargv.c"

file, then this function (unicode variant here, there is non-unicode too):

static void __cdecl wparse_cmdline()

It could be that it's behaviour is where close to what CommandLineToArgcW, but the CRT is not using that function.

Probably so that the CRT does not have dependency on SHELL32.dll (where the function comes from).

One thing that MSVCRT implements, if you link with setargv.obj/wsetargv.obj (unicode) is some kind of globbing that is found in Unixes - I've used it in the past - one has just to add setargv.obj somewhere in the linker options.

it's in here, usually part of your LIB env.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib


On 12/8/2011 6:36 AM, Jerome Vuarand wrote:
2011/12/8 Lorenzo Donati<>:
Running the test suite with:

..\src\lua -e"_U=true" all.lua

was ok, but note that I had to change single quotes into double quotes.
When using (as suggested in

..\src\lua -e'_U=true' all.lua

with XP command prompt I got the error:

..\src\lua: (command line):1: unexpected symbol near ''_U=true''

That's because of the way the C runtime library splits command line
and handles quoting. Contrary to Unix, the Windows command lines are
passed as a single string to the called process, and the C runtime
library is splitting it into argc and argv. The C runtime library
you're using seems not to handle single quotes like you expect. If
it's anything like CommandLineToArgcW function [1] (which I believe
the MSVC libc is calling), it only treats double quotes specially and
pass single quotes unchanged (and the string [[ '_U=true' ]] is not
valid Lua code).