[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaJIT 2 crash when compiled in WIN64 + UNICODE
- From: Laurent Poujoulat <laurent.poujoulat@...>
- Date: Fri, 02 Sep 2011 10:30:45 +0200
Hello All,
I was porting one application embedding LuaJIT 2 from WIN32 to WIN64.
The application is compiled in Unicode mode. The application crashed in
the JIT initialization. The reason comes from the way the pointer to the
allocation function is taken in lj_alloc.c. It use the GetModuleHandle()
function. This function has two flavors: one with wide chars and one
with chars. In LuaJIT, the parameter is always a char string, so when
passed on the wide char version of GetModuleHandle() it don't understand
the ntdll.dll name, returns a NULL pointer and crashes.
The fix is easy: just use GetModuleHandleA() instead of
GetModuleHandle() so that it always use the ANSI flavour whatever we are
in WIN64 or WIN32.
Hope this may be helpful to someone.
Regards,
--
Laurent POUJOULAT
Ingénieur Système / System Engineer
Tél: +33 (0)1 53 66 39 89
Fax: +33 (0)1 43 76 91 25
ART Technology
Le Chanzy
18 avenue Winston Churchill
94220 CHARENTON LE PONT
FRANCE