dllimport the variable for MSVC in link-order.at

* tests/link-order.at [MSVC]: Makes the test pass by dllimporting
imported variables when working with shared libraries.
This commit is contained in:
Peter Rosin 2010-07-17 04:05:33 +02:00
parent 0656b19eb9
commit 653fa66d07
2 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-07-17 Peter Rosin <peda@lysator.liu.se>
dllimport the variable for MSVC in link-order.at
* tests/link-order.at [MSVC]: Makes the test pass by dllimporting
imported variables when working with shared libraries.
2010-07-08 Peter Rosin <peda@lysator.liu.se>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

View File

@ -48,13 +48,31 @@ for i in old new; do
mkdir src
cat >src/a_$i.c <<EOF
extern int c;
/* w32 fun, MSVC needs to dllimport when using a shared library, so use
* DLL_EXPORT to discriminate as that happens to coinside in this case.
* gnu has auto import.
*/
#if defined _MSC_VER && defined DLL_EXPORT
# define LIBCEE_SCOPE __declspec(dllimport)
#else
# define LIBCEE_SCOPE extern
#endif
LIBCEE_SCOPE int c;
extern int b_$i();
int a_$i() { return c + b_$i(); }
EOF
cat >src/b_$i.c <<EOF
extern int c;
/* w32 fun, MSVC needs to dllimport when using a shared library, so use
* DLL_EXPORT to discriminate as that happens to coinside in this case.
* gnu has auto import.
*/
#if defined _MSC_VER && defined DLL_EXPORT
# define LIBCEE_SCOPE __declspec(dllimport)
#else
# define LIBCEE_SCOPE extern
#endif
LIBCEE_SCOPE int c;
int b_$i() { return 1 + c; }
EOF