lua-users home
lua-l archive

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


On 12/05/2011 1.02, Lorenzo Donati wrote:
Hi all!

I've already built successfully srlua on Windows using the "clean C
distribution" (srlua.tar.gz)

Then I noticed the file srlua.tgz and that it also contains a wsrlua.c
file which avoids displaying a DOS black box when running a
srlua-packaged executable.

I tried to compile it, but it always fails, no matter what I try.

System: Windows XP
Compiler: tdm-gcc 4.3.1

I tried to compile wsrlua.c with the following invocation:

---------------------------
gcc -c -O2 -Wall -pedantic -std=c99 -mwindows -mwin32 -I
G:\root\main\core\Lua/app/Lua-sys/include winsrc/wsrlua.c -o
winbuild/wsrlua.o
winsrc/wsrlua.c: In function 'thMain':
winsrc/wsrlua.c:13:16: error: '__argc' undeclared (first use in this
function)
winsrc/wsrlua.c:13:16: note: each undeclared identifier is reported only
once for each function it appears in
winsrc/wsrlua.c:13:24: error: '__argv' undeclared (first use in this
function)
mingw32-make: *** [build] Error 1
---------------------------

it always complains about those two missing identifiers: __argc and __argv.


I see that in the distribution there are some MS-compilers project
files, so I fear wsrlua.c is compilable only with MS toolchain.


Is there a way to compile it with my compiler?

Any help appreciated.


Cheers.
-- Lorenzo


I solved the issue modifying wsrlua.c (but I still don't know if it is a reliable solution or it has some unwanted side effects).

I added these two declarations just after the #include directives at the top:

--------------------
extern int __argc;
extern char** __argv;
---------------------

TDM-MINGW 4.5.1 still complained (with an info message) about implicitly using auto imports without the proper command line switch, but this message went away when I updated to TDM-MINGW 4.5.2.

(Sorry for the typo in the previous message, in which I indicated 4.3.1 as the compiler version - it was meant to be 4.5.1).


If what I found is a sound solution for compiling wsrlua.c with mingw, wouldn't it a good thing if this modification were added to the original source?

Thanks.

-- Lorenzo