This is with glib-1.2.10-5. Anyone know anything about glib's G_LOCK_DEFINE_STATIC? I have an app that uses it like so:
/* this mutex provides a lock for stdout to avoid display conflict between thread */ G_LOCK_DEFINE_STATIC(stdout); <--- line 39 G_LOCK(stdout); <--- line 137 And it won't compile: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/sw/include/glib-1.2 -I/sw/lib/glib/include -no-cpp-precomp -c display.c display.c:39: parse error before `&' display.c: In function `disp_msg_full': display.c:137: parse error before `_lock' display.c:137: parse error before `_lock' The relevant part of glib-1.2/glib.h. All this preprocessor stuff is almost as confusing as libtool. Theres a reason they say "The C preprocessor is very powerful. Never use it." :) That "## name ##" part looks bad.. is that correct? /* these are some convenience macros that expand to nothing if GLib * was configured with --disable-threads. for using StaticMutexes, * you define them with G_LOCK_DEFINE_STATIC (name) or G_LOCK_DEFINE (name) * if you need to export the mutex. With G_LOCK_EXTERN (name) you can * declare such an globally defined lock. name is a unique identifier * for the protected varibale or code portion. locking, testing and * unlocking of such mutexes can be done with G_LOCK(), G_UNLOCK() and * G_TRYLOCK() respectively. */ extern void glib_dummy_decl (void); #define G_LOCK_NAME(name) (g__ ## name ## _lock) #ifdef G_THREADS_ENABLED # define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name) # define G_LOCK_DEFINE(name) \ GStaticMutex G_LOCK_NAME (name) = G_STATIC_MUTEX_INIT # define G_LOCK_EXTERN(name) extern GStaticMutex G_LOCK_NAME (name) # ifdef G_DEBUG_LOCKS # define G_LOCK(name) G_STMT_START{ \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "file %s: line %d (%s): locking: %s ", \ __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ #name); \ g_static_mutex_lock (&G_LOCK_NAME (name)); \ }G_STMT_END # define G_UNLOCK(name) G_STMT_START{ \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "file %s: line %d (%s): unlocking: %s ", \ __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ #name); \ g_static_mutex_unlock (&G_LOCK_NAME (name)); \ }G_STMT_END # define G_TRYLOCK(name) G_STMT_START{ \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "file %s: line %d (%s): try locking: %s ", \ __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ #name); \ }G_STMT_END, g_static_mutex_trylock (&G_LOCK_NAME (name)) # else /* !G_DEBUG_LOCKS */ # define G_LOCK(name) g_static_mutex_lock (&G_LOCK_NAME (name)) # define G_UNLOCK(name) g_static_mutex_unlock (&G_LOCK_NAME (name)) # define G_TRYLOCK(name) g_static_mutex_trylock (&G_LOCK_NAME (name)) # endif /* !G_DEBUG_LOCKS */ #else /* !G_THREADS_ENABLED */ # define G_LOCK_DEFINE_STATIC(name) extern void glib_dummy_decl (void) # define G_LOCK_DEFINE(name) extern void glib_dummy_decl (void) # define G_LOCK_EXTERN(name) extern void glib_dummy_decl (void) # define G_LOCK(name) # define G_UNLOCK(name) # define G_TRYLOCK(name) (FALSE) #endif /* !G_THREADS_ENABLED */ -- http://homepage.mac.com/bhines/ _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel