Hi all,
I'm compiling wine on x86-64 after configuring with --enable-win64 and I get the error:
irotp.c:54: error: initializer element is not computable at load time irotp.c:54: error: (near initialization for 'critsect_debug.Spare[0]')
on this this code:
51: static CRITICAL_SECTION_DEBUG critsect_debug = 52: { 53: 0, 0, &csRunningObjectTable, 53: { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, 54: 0, 0, { (DWORD_PTR)(__FILE__ ": csRunningObjectTable") } 55: };
Anybody understand why?
Cheers, Erik
Erik de Castro Lopo skrev:
Anybody understand why?
You could look up the definition of RTL_CRITICAL_SECTION_DEBUG in include/winnt.h. Then realize that __WINESRC__ is only defined for stuff in dlls/, not for stuff in programs/, which should make the type mismatch clear.
Ove Kaaven wrote:
Erik de Castro Lopo skrev:
Anybody understand why?
You could look up the definition of RTL_CRITICAL_SECTION_DEBUG in include/winnt.h. Then realize that __WINESRC__ is only defined for stuff in dlls/, not for stuff in programs/, which should make the type mismatch clear.
The error message says nothing about a type mismatch its complaining about something not being compulatble a load time.
In include/winnt.h we have:
#ifdef __WINESRC__ /* in Wine we store the name here */ DWORD_PTR Spare[8/sizeof(DWORD_PTR)]; #else DWORD Spare[ 2 ]; #endif
and the code tries to initialize Spare with this:
{ (DWORD_PTR)(__FILE__ ": csRunningObjectTable") }
That makes me suspect that the non __WINESRC__ definition is wrong and that the whole #ifdef above could be replaced with
DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
Is that right?
Erik
Erik de Castro Lopo skrev:
Ove Kaaven wrote:
Erik de Castro Lopo skrev:
Anybody understand why?
You could look up the definition of RTL_CRITICAL_SECTION_DEBUG in include/winnt.h. Then realize that __WINESRC__ is only defined for stuff in dlls/, not for stuff in programs/, which should make the type mismatch clear.
The error message says nothing about a type mismatch its complaining about something not being compulatble a load time.
Yes, I said "type mismatch" to clarify the error. It's not possible to fit a 64-bit pointer value into a static 32-bit DWORD at "load time" (probably means relocation time). The types aren't compatible.
That makes me suspect that the non __WINESRC__ definition is wrong and that the whole #ifdef above could be replaced with
DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
Is that right?
No, in the case of Winelib apps, every Wine definition should match the Windows definition exactly. And here, DWORD_PTR would be 64-bit and DWORD would be 32-bit, so it's not exactly a perfect match.
But I'm not proposing any particular solution, I just said what's wrong.