Le mer 10/09/2003 à 14:14, Shachar Shemesh a écrit :
Vincent Béron wrote:
Le mer 10/09/2003 à 11:51, Shachar Shemesh a écrit :
That's exactly the problem I'm having with compiling Wine without optimizations. the wine binary tries to link with ntdll. ntdll needs "InterlockedCompareExchange" from kernel32. In my case, this translates to a compilation error, which I have not managed to eliminate.
I'm leaning towards the inline InterlockedCompareExchange from winbase.h, as if I rebuild ntdll with -O1 miscemu/wine is built correctly (ie ntdll doesn't have any undefined references). It's from win32/device.c and win32/except.c which call InterlockedCompareExchangePointer(), which itself calls InterlockedCompareExchange() from winbase.h.
"extern inline InterlockedCompareExchange() {return bar();}" seems a bit odd for a function definition. What the purpose of having both extern and inline?
Probably should be "static inline". That's the way you usually do it inside headers.
That's how InterlockedCompareExchangePointer() is defined. I'll try that.
Result: fails, because it's only a replacement implementation (hence the extern). Actually, only defining InterlockedCompareExchange as static inline works, but it becomes highly tricky, since there's a slew of other functions still defined as extern inline in the same chunk of winbase.h.
I was under the impression that InterlockedCompareExchange rightfully belonged in kernel32 (that's where nm said it was defined, after all). That's why I thought this was a circular dependancy.
Ahh, I now see why I thought so. It is also defined in dlls/kernel/sync.c as a regular function. MSDN says this:
*Client: *Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0, Windows Me, and Windows 98. *Server: *Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 4.0. *Header: *Declared in Winbase.h; include Windows.h. *Library: *Use Kernel32.lib.
I think it's probably a bad idea to use this function (actually, InterlockedCompareExchangePointer) from ntdll at all. This is a circular dependancy, even if we manage to get away with it using optimizer tricks.
Dll separation issue then.
While I think the the "-lntdll" is a strange kludge in miscemu/wine makefile, and therefor should go if it's indeed not necessary, I don't think it is correct to load kernel32 before ntdll. The DLLs obviously depend one on the other in the opposite order (or, more precisely, should).
Actually, wine doesn't run even if it links if I remove -lntdll. So it must stay as a dependency of wine.
Vincent