[AD] Inline functions and C++ |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Following the thread on [AL] (mingw C++ not inlining... inline problems)
dated 05/06, I propose the following fix:
--- cvsroot/allegro/include/allegro/internal/alconfig.h Fri Apr 12 15:45:12 2002
+++ allegro/include/allegro/internal/alconfig.h Wed May 8 10:35:10 2002
@@ -58,7 +58,11 @@
#define ALLEGRO_GCC
#ifndef AL_INLINE
- #define AL_INLINE(type, name, args, code) extern __inline__ type name args code
+ #ifdef __cplusplus
+ #define AL_INLINE(type, name, args, code) static inline type name args code
+ #else
+ #define AL_INLINE(type, name, args, code) extern __inline__ type name args code
+ #endif
#endif
The problem is, on platforms which don't support weak symbols, G++ produces
a strong global symbol for functions declared with 'extern __inline__' when
no optimization is used. This symbol can conflict with the one imported from
inline.o when C and C++ source files are mixed.
I had originally intended to put the fix in almingw32.h, but then I
remembered that Darwin doesn't support weak symbols too, hence
the new location.
Tested under DJGPP, Mingw32, Linux and QNX.
--
Eric Botcazou
ebotcazou@xxxxxxxxxx