Problems building with extern inline functions in winebase.h

Alexandre Julliard julliard at winehq.com
Thu Aug 16 12:37:39 CDT 2001


Mike Bond <mbond at cox.rr.com> writes:

> A couple days ago a number of inline functions were put into winebase.h.
> Since then I have been unable to build, using gcc 2.96-81 (RedHat). Apparently
> this version of gcc thinks that because there is an extern prefixing the
> inline, even though the function does in fact have a body, that the
> function really is external. Removing the extern, just having inline as
> one would do in C++, does not appear to work correctly either, and causes
> the function to appear as a exported symbol in all the object files that
> header gets included with, thus resulting in multiple definitions.

This patch should fix the build failure, though it doesn't explain why
gcc doesn't inline such a simple function.

Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /opt/cvs-commit/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.39
diff -u -r1.39 kernel32.spec
--- dlls/kernel/kernel32.spec	2001/08/06 17:50:42	1.39
+++ dlls/kernel/kernel32.spec	2001/08/16 16:30:03
@@ -922,7 +922,9 @@
 @ stub GetProcessPriorityBoost
 @ stdcall GetThreadPriorityBoost(long ptr) GetThreadPriorityBoost 
 @ stdcall InterlockedCompareExchange (ptr long long) InterlockedCompareExchange
+@ stdcall InterlockedCompareExchangePointer(ptr ptr ptr) InterlockedCompareExchangePointer
 @ stdcall InterlockedExchangeAdd (ptr long ) InterlockedExchangeAdd
+@ stdcall InterlockedExchangePointer(ptr ptr) InterlockedExchangePointer
 @ stdcall IsProcessorFeaturePresent(long) IsProcessorFeaturePresent
 @ stdcall OpenWaitableTimerA(long long str) OpenWaitableTimerA
 @ stdcall OpenWaitableTimerW(long long wstr) OpenWaitableTimerW
Index: scheduler/critsection.c
===================================================================
RCS file: /opt/cvs-commit/wine/scheduler/critsection.c,v
retrieving revision 1.30
diff -u -r1.30 critsection.c
--- scheduler/critsection.c	2001/08/09 21:21:13	1.30
+++ scheduler/critsection.c	2001/08/16 16:30:11
@@ -86,7 +86,7 @@
 /***********************************************************************
  *		InterlockedCompareExchange (KERNEL32.@)
  */
-/* PVOID WINAPI InterlockedCompareExchange( PVOID *dest, PVOID xchg, PVOID compare ); */
+/* LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare ); */
 __ASM_GLOBAL_FUNC(InterlockedCompareExchange,
                   "movl 12(%esp),%eax\n\t"
                   "movl 8(%esp),%ecx\n\t"
@@ -95,10 +95,31 @@
                   "ret $12");
 
 /***********************************************************************
+ *		InterlockedCompareExchangePointer (KERNEL32.@)
+ */
+/* PVOID WINAPI InterlockedCompareExchangePointer( PVOID *dest, PVOID xchg, PVOID compare ); */
+__ASM_GLOBAL_FUNC(InterlockedCompareExchangePointer,
+                  "movl 12(%esp),%eax\n\t"
+                  "movl 8(%esp),%ecx\n\t"
+                  "movl 4(%esp),%edx\n\t"
+                  "lock; cmpxchgl %ecx,(%edx)\n\t"
+                  "ret $12");
+
+/***********************************************************************
  *		InterlockedExchange (KERNEL32.@)
  */
 /* LONG WINAPI InterlockedExchange( PLONG dest, LONG val ); */
 __ASM_GLOBAL_FUNC(InterlockedExchange,
+                  "movl 8(%esp),%eax\n\t"
+                  "movl 4(%esp),%edx\n\t"
+                  "lock; xchgl %eax,(%edx)\n\t"
+                  "ret $8");
+
+/***********************************************************************
+ *		InterlockedExchangePointer (KERNEL32.@)
+ */
+/* PVOID WINAPI InterlockedExchangePointer( PVOID *dest, PVOID val ); */
+__ASM_GLOBAL_FUNC(InterlockedExchangePointer,
                   "movl 8(%esp),%eax\n\t"
                   "movl 4(%esp),%edx\n\t"
                   "lock; xchgl %eax,(%edx)\n\t"

-- 
Alexandre Julliard
julliard at winehq.com




More information about the wine-devel mailing list