From d2223c3fbc1083422f1d5a31d374a21552de999b Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Fri, 14 Jan 2000 13:28:52 +0000 Subject: [PATCH] * libltdl/ltdl.h (LTDL_STMT_START, LTDL_STMT_END): Macros for wrapping other macros to make a portable compound statement from multiple C statements in the expansion. (LTDL_SET_PRELOADED_SYMBOLS): Use the above macros to add an extern declaration for lt_preloaded_symbols, to remove dependency on undefined symbol from libltdl.dll on cygwin (and other -no-undefined architectures). * libltdl/ltdl.c (lt_preloaded_symbols): No longer defined here. --- ChangeLog | 9 +++++++++ libltdl/ltdl.c | 5 ----- libltdl/ltdl.h | 24 ++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 362d85f23..a5dacb29a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2000-01-14 Gary V. Vaughan + * libltdl/ltdl.h (LTDL_STMT_START, LTDL_STMT_END): Macros for + wrapping other macros to make a portable compound statement from + multiple C statements in the expansion. + (LTDL_SET_PRELOADED_SYMBOLS): Use the above macros to add an + extern declaration for lt_preloaded_symbols, to remove + dependency on undefined symbol from libltdl.dll on cygwin (and + other -no-undefined architectures). + * libltdl/ltdl.c (lt_preloaded_symbols): No longer defined here. + * libtool,m4 (AC_LIBTOOL_SETUP): The result of lt_cv_need_dllmain was set to the opposite of what it should be. * configure.in (AC_LIBTOOL_WIN32_DLL): Call to this macro is diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 9cb5887e7..cb86a5d69 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -104,11 +104,6 @@ static const char invalid_handle_error[] = "invalid handle"; static const char buffer_overflow_error[] = "internal buffer overflow"; static const char shutdown_error[] = "library already shutdown"; -#ifndef HAVE_PRELOADED_SYMBOLS -/* If libtool won't define it, we'd better do */ -LTDL_GLOBAL_DATA const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } }; -#endif - static const char *last_error = 0; LTDL_GLOBAL_DATA lt_ptr_t (*lt_dlmalloc) LTDL_PARAMS((size_t size)) = (lt_ptr_t(*)LTDL_PARAMS((size_t)))malloc; diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index 0fafa207c..76c451a44 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -66,6 +66,24 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # define lt_ptr_t char* #endif +/* LTDL_STMT_START/END are used to create macros which expand to a + a single compound statement in a portable way. */ +#undef LTDL_STMT_START +#undef LTDL_STMT_END +#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) +# define LTDL_STMT_START (void)( +# define LTDL_STMT_END ) +#else +# if (defined (sun) || defined (__sun__)) +# define LTDL_STMT_START if (1) +# define LTDL_STMT_END else (void)0 +# else +# define LTDL_STMT_START do +# define LTDL_STMT_END while (0) +# endif +#endif + + #ifdef WIN32 # ifndef __CYGWIN__ /* LTDL_DIRSEP_CHAR is accepted *in addition* to '/' as a directory @@ -130,8 +148,10 @@ extern int lt_dlsetdata LTDL_PARAMS((lt_dlhandle handle, lt_ptr_t data)); extern lt_ptr_t lt_dlgetdata LTDL_PARAMS((lt_dlhandle handle)); extern const lt_dlinfo *lt_dlgetinfo LTDL_PARAMS((lt_dlhandle handle)); -LTDL_SCOPE const lt_dlsymlist lt_preloaded_symbols[]; -#define LTDL_SET_PRELOADED_SYMBOLS() lt_dlpreload_default(lt_preloaded_symbols) +#define LTDL_SET_PRELOADED_SYMBOLS() LTDL_STMT_START{ \ + extern const lt_dlsymlist lt_preloaded_symbols[]; \ + lt_dlpreload_default(lt_preloaded_symbols); \ + }LTDL_STMT_END LTDL_SCOPE lt_ptr_t (*lt_dlmalloc)LTDL_PARAMS((size_t size)); LTDL_SCOPE void (*lt_dlfree)LTDL_PARAMS((lt_ptr_t ptr)); -- 2.47.3