Makes the touched tests pass for MSVC when DLLs are built.
* tests/demo/Makefile.am, tests/pdemo/Makefile.am: Define
BUILDING_LIBHELLO when building libhello.la.
* tests/demo/foo.h, tests/pdemo/foo.h (nothing) <MSVC>: Export
variable when building the libhello dll and import when using
libhello. For GCC and non-w32, and when building a static
libhello, leave as an ordinary extern.
* tests/pdemo/foo.h [Cygwin]: Remove unneeded and "dead" export
and import logic (LIBFOO_DLL is always undefined).
* tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c (_LIBFOO_COMPILATION_): Not
useful before, even less so now. Removed.
* tests/depdemo/l1/Makefile.am: Define BUILDING_LIBL1 when
building libl1.la.
* tests/depdemo/l2/Makefile.am: Define BUILDING_LIBL2 when
building libl2.la.
* tests/depdemo/l3/Makefile.am: Define BUILDING_LIBL3 when
building libl3.la.
* tests/depdemo/l4/Makefile.am: Define BUILDING_LIBL4 when
building libl4.la.
* tests/depdemo/l1/l1.h, tests/depdemo/l2/l2.h,
tests/depdemo/l3/l3.h, tests/depdemo/l4/l4.h <MSVC>: Export
variables when building the associated library dll and import
when using the library. For GCC and non-w32, and when building
static libraries, leave as an ordinary extern.
Signed-off-by: Peter Rosin <peda@lysator.liu.se>
+2010-09-27 Peter Rosin <peda@lysator.liu.se>
+
+ tests: clean up importing and exporting on w32.
+ Makes the touched tests pass for MSVC when DLLs are built.
+ * tests/demo/Makefile.am, tests/pdemo/Makefile.am: Define
+ BUILDING_LIBHELLO when building libhello.la.
+ * tests/demo/foo.h, tests/pdemo/foo.h (nothing) <MSVC>: Export
+ variable when building the libhello dll and import when using
+ libhello. For GCC and non-w32, and when building a static
+ libhello, leave as an ordinary extern.
+ * tests/pdemo/foo.h [Cygwin]: Remove unneeded and "dead" export
+ and import logic (LIBFOO_DLL is always undefined).
+ * tests/pdemo/longer_file_name_foo.c,
+ tests/pdemo/longer_file_name_foo2.c (_LIBFOO_COMPILATION_): Not
+ useful before, even less so now. Removed.
+ * tests/depdemo/l1/Makefile.am: Define BUILDING_LIBL1 when
+ building libl1.la.
+ * tests/depdemo/l2/Makefile.am: Define BUILDING_LIBL2 when
+ building libl2.la.
+ * tests/depdemo/l3/Makefile.am: Define BUILDING_LIBL3 when
+ building libl3.la.
+ * tests/depdemo/l4/Makefile.am: Define BUILDING_LIBL4 when
+ building libl4.la.
+ * tests/depdemo/l1/l1.h, tests/depdemo/l2/l2.h,
+ tests/depdemo/l3/l3.h, tests/depdemo/l4/l4.h <MSVC>: Export
+ variables when building the associated library dll and import
+ when using the library. For GCC and non-w32, and when building
+ static libraries, leave as an ordinary extern.
+
2010-09-26 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
docs: do not refer to Libtool version with dlopen functionality.
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003, 2004, 2005 Free Software Foundation
+## Copyright (C) 2003, 2004, 2005, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
libhello_la_SOURCES = hello.c foo.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
+libhello_la_AM_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO
include_HEADERS = foo.h
# endif
#endif
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBHELLO
+# ifdef DLL_EXPORT
+# define LIBHELLO_SCOPE extern __declspec (dllexport)
+# endif
+# else
+# define LIBHELLO_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBHELLO_SCOPE
+# define LIBHELLO_SCOPE extern
+#endif
+
/* __BEGIN_DECLS should be used at the beginning of your declarations,
so that C++ compilers don't mangle their names. Use __END_DECLS at
the end of C declarations. */
__BEGIN_DECLS
int foo LT_PARAMS((void));
int hello LT_PARAMS((void));
-extern int nothing;
+LIBHELLO_SCOPE int nothing;
__END_DECLS
#endif /* !_FOO_H_ */
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
AUTOMAKE_OPTIONS = no-dependencies foreign
-AM_CPPFLAGS = -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL1
lib_LTLIBRARIES = libl1.la
libl1_la_SOURCES = l1.c l1.h
/* l1.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
Written by Thomas Tanner, 1998
This file is part of GNU Libtool.
#include "sysdep.h"
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBL1
+# ifdef DLL_EXPORT
+# define LIBL1_SCOPE extern __declspec (dllexport)
+# endif
+# else
+# define LIBL1_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBL1_SCOPE
+# define LIBL1_SCOPE extern
+#endif
+
__BEGIN_DECLS
-extern int var_l1;
+LIBL1_SCOPE int var_l1;
int func_l1 __P((int));
__END_DECLS
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
AUTOMAKE_OPTIONS = no-dependencies foreign
-AM_CPPFLAGS = -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL2
lib_LTLIBRARIES = libl2.la
libl2_la_SOURCES = l2.c l2.h
/* l2.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
Written by Thomas Tanner, 1998
This file is part of GNU Libtool.
#include "sysdep.h"
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBL2
+# ifdef DLL_EXPORT
+# define LIBL2_SCOPE extern __declspec (dllexport)
+# endif
+# else
+# define LIBL2_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBL2_SCOPE
+# define LIBL2_SCOPE extern
+#endif
+
__BEGIN_DECLS
-extern int var_l2;
+LIBL2_SCOPE int var_l2;
int func_l2 __P((int));
__END_DECLS
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
AUTOMAKE_OPTIONS = no-dependencies foreign
-AM_CPPFLAGS = -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL3
lib_LTLIBRARIES = libl3.la
libl3_la_SOURCES = l3.c l3.h
/* l3.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
Written by Thomas Tanner, 1998
This file is part of GNU Libtool.
#include "sysdep.h"
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBL3
+# ifdef DLL_EXPORT
+# define LIBL3_SCOPE extern __declspec (dllexport)
+# endif
+# else
+# define LIBL3_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBL3_SCOPE
+# define LIBL3_SCOPE extern
+#endif
+
__BEGIN_DECLS
-extern int var_l3;
+LIBL3_SCOPE int var_l3;
int func_l3 __P((int));
__END_DECLS
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
AUTOMAKE_OPTIONS = no-dependencies foreign
-AM_CPPFLAGS = -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_srcdir) -DBUILDING_LIBL4
lib_LTLIBRARIES = libl4.la
libl4_la_SOURCES = l4.c l4.h
/* l4.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
Written by Thomas Tanner, 1998
This file is part of GNU Libtool.
#include "sysdep.h"
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBL4
+# ifdef DLL_EXPORT
+# define LIBL4_SCOPE extern __declspec (dllexport)
+# endif
+# else
+# define LIBL4_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBL4_SCOPE
+# define LIBL4_SCOPE extern
+#endif
+
__BEGIN_DECLS
-extern int var_l4;
+LIBL4_SCOPE int var_l4;
int func_l4 __P((int));
__END_DECLS
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003, 2004, 2005 Free Software Foundation
+## Copyright (C) 2003, 2004, 2005, 2010 Free Software Foundation
## Written by Gary V. Vaughan, 2003
##
## This file is part of GNU Libtool.
libhello_la_SOURCES = longer_file_name_hello.c longer_file_name_foo.c longer_file_name_foo2.c
libhello_la_LIBADD = $(LIBM)
libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
+libhello_la_AM_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO
include_HEADERS = foo.h
# define LT_DLSYM_CONST const
#endif
-#ifdef __CYGWIN32__
-# ifdef LIBFOO_DLL
- /* need some (as yet non-existant) automake magic to tell
- * the object whether the libfoo it will be linked with is
- * a dll or not, ie whether LIBFOO_DLL is defined or not.
- */
-# ifdef _LIBFOO_COMPILATION_
-# define EXTERN __declspec(dllexport)
-# else
-# define EXTERN extern __declspec(dllimport)
-# endif
-# else
-# define EXTERN extern
+#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__
+# ifdef BUILDING_LIBHELLO
+# ifdef DLL_EXPORT
+# define LIBHELLO_SCOPE extern __declspec (dllexport)
# endif
-#else
-# define EXTERN extern
+# else
+# define LIBHELLO_SCOPE extern __declspec (dllimport)
+# endif
+#endif
+#ifndef LIBHELLO_SCOPE
+# define LIBHELLO_SCOPE extern
#endif
/* Silly constants that the functions return. */
int foo LT_PARAMS((void));
int foo2 LT_PARAMS((void));
int hello LT_PARAMS((void));
-EXTERN int nothing;
+LIBHELLO_SCOPE int nothing;
__END_DECLS
#endif /* !_FOO_H_ */
/* foo.c -- trivial test function for libfoo
- Copyright (C) 1996-1999, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2007, 2010 Free Software Foundation, Inc.
Written by Gordon Matzigkeit, 1996
This file is part of GNU Libtool.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#define _LIBFOO_COMPILATION_
#include "foo.h"
-#undef _LIBFOO_COMPILATION_
#include <stdio.h>
#include <math.h>
/* foo.c -- trivial test function for libfoo
- Copyright (C) 1996-1999, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2007, 2010 Free Software Foundation, Inc.
Written by Gordon Matzigkeit, 1996
This file is part of GNU Libtool.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#define _LIBFOO_COMPILATION_
#include "foo.h"
-#undef _LIBFOO_COMPILATION_
#include <stdio.h>
#include <math.h>