lua-users home
lua-l archive

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


于 2012-4-29 22:59, Shmuel Zeigerman 写道:
On 29/04/2012 08:04, Peng Zhicheng wrote:

I just tried the same experiment on Windows 7 x64 with MinGW64 (GCC 4.6.3) and got the same error. Could you give the details about how you build the test application, GCC version, etc.?


My MinGW installation has gcc version 4.5.2

I at first built a `clean' lua51.dll and lua.exe using the default configuration, i. e. just "make mingw",
then I build this test code using the command "g++ -shared -o mylib.dll -I lua-5.1.5/src mylib.cpp"
all went ok.



My understanding is that the "default" build that does not use any "special" CFLAGS or LDFLAGS should run without any errors.


yes, it should, and it did on my computer.



However I'd like to understand what part of the program causes this (may be insignificant) problem and how to avoid it.

I don't know the reason. since it seems just OK on my system.

I did some further experiments. I set a break point at `TlsAlloc',
and my debugger stopped just a few times there, but all before the EntryPoint of lua.exe is reached.
which means all are called by the system loader before even the program is completely loaded.

And then after the program started running from its entry point, the function TlsAlloc was never called again.
and finally the program exit normally. that means, the program did not allocate any TLS slots at all!
so there couldn't be such problem as `not freed TLS index'. so I suppose this might be a OS specific problem.


maybe you have something special installed on your system?
I will give the list of all the modules loaded by the program, showed in the debugger.

oh, just to mention, I used the OllyDBG debugger.

Executable modules
base size entry name version path
00400000 0000A000 00401160 l lua D:\Documents and Settings\Administrator\Desktop\lua-5.1.5\verify\lua.exe
10000000 0004D000 1000A178 g guard32 5, 10, 228257, 2253 D:\WINDOWS\SysWOW64\guard32.dll
5F080000 00008000 5F082918 f fltlib 5.2.3790.1830 (srv03_sp1_rtm.05 D:\WINDOWS\system32\fltlib.dll
66D80000 0002C000 66D810C0 l lua51 D:\Documents and Settings\Administrator\Desktop\lua-5.1.5\verify\lua51.dll
6E580000 0000B000 6E5810C0 m mylib D:\Documents and Settings\Administrator\Desktop\lua-5.1.5\verify\mylib.dll
6E940000 00021000 6E9410C0 l libgcc_s E:\Applications\development\toolchain\mingw32\bin\libgcc_s_dw2-1.dll
75490000 00065000 754C93EA U USP10 1.0422.3790.4695 (srv03_sp2_gdr D:\WINDOWS\system32\USP10.dll
77B90000 00008000 77B91186 V VERSION 5.2.3790.1830 (srv03_sp1_rtm.05 D:\WINDOWS\syswow64\VERSION.dll
77BA0000 0005A000 77BAF78B m msvcrt 7.0.3790.3959 (srv03_sp2_rtm.07 D:\WINDOWS\syswow64\msvcrt.dll
7D1E0000 0009C000 7D206E73 A ADVAPI32 5.2.3790.4455 (srv03_sp2_gdr.09 D:\WINDOWS\syswow64\ADVAPI32.dll
7D4C0000 00130000 7D4DFD69 k kernel32 5.2.3790.4480 (srv03_sp2_gdr.09 D:\WINDOWS\syswow64\kernel32.dll
7D600000 000F0000 ntdll 5.2.3790.4937 (srv03_sp2_gdr.11 D:\WINDOWS\system32\ntdll.dll
7D800000 00090000 7D82B710 G GDI32 5.2.3790.4396 (srv03_sp2_gdr.08 D:\WINDOWS\syswow64\GDI32.dll
7D8D0000 00050000 7D8E0E6B S Secur32 5.2.3790.4530 (srv03_sp2_gdr.09 D:\WINDOWS\syswow64\Secur32.dll
7D930000 000D0000 7D969635 U USER32 5.2.3790.4033 (srv03_sp2_gdr.07 D:\WINDOWS\syswow64\USER32.dll
7DA20000 000E0000 7DA3049E R RPCRT4 5.2.3790.4759 (srv03_sp2_gdr.10 D:\WINDOWS\syswow64\RPCRT4.dll
7DBC0000 00009000 7DBC12E2 L LPK 5.2.3790.3959 (srv03_sp2_rtm.07 D:\WINDOWS\system32\LPK.DLL
7DEE0000 00060000 7DEF02D0 I IMM32 5.2.3790.3959 (srv03_sp2_rtm.07 D:\WINDOWS\system32\IMM32.DLL