2000-01-14 Gary V. Vaughan <gary@oranda.demon.co.uk>
+ * 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
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;
# 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
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));