diff --git a/test cases/common/46 library chain/subdir/lib1.c b/test cases/common/46 library chain/subdir/lib1.c index a1fd5bc6f..499ef82bf 100644 --- a/test cases/common/46 library chain/subdir/lib1.c +++ b/test cases/common/46 library chain/subdir/lib1.c @@ -1,6 +1,17 @@ int lib2fun(); int lib3fun(); -int libfun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC libfun() { return lib2fun() + lib3fun(); } diff --git a/test cases/common/46 library chain/subdir/subdir2/lib2.c b/test cases/common/46 library chain/subdir/subdir2/lib2.c index 490e44463..34fadf2a6 100644 --- a/test cases/common/46 library chain/subdir/subdir2/lib2.c +++ b/test cases/common/46 library chain/subdir/subdir2/lib2.c @@ -1,3 +1,14 @@ -int lib2fun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib2fun() { return 0; } diff --git a/test cases/common/46 library chain/subdir/subdir3/lib3.c b/test cases/common/46 library chain/subdir/subdir3/lib3.c index fed00d541..7bd88afdd 100644 --- a/test cases/common/46 library chain/subdir/subdir3/lib3.c +++ b/test cases/common/46 library chain/subdir/subdir3/lib3.c @@ -1,3 +1,14 @@ -int lib3fun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib3fun() { return 0; } diff --git a/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h index 9261c7833..681c7b890 100644 --- a/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h +++ b/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h @@ -1,6 +1,21 @@ #ifndef SUBDEFS_H_ #define SUBDEFS_H_ -int subfunc(); +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_SUB + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC subfunc(); #endif diff --git a/test cases/common/49 subproject/subprojects/sublib/meson.build b/test cases/common/49 subproject/subprojects/sublib/meson.build index d8e414046..0b6911d21 100644 --- a/test cases/common/49 subproject/subprojects/sublib/meson.build +++ b/test cases/common/49 subproject/subprojects/sublib/meson.build @@ -5,6 +5,7 @@ if not meson.is_subproject() endif i = include_directories('include') -l = shared_library('sublib', 'sublib.c', include_directories : i, install : true) +l = shared_library('sublib', 'sublib.c', include_directories : i, install : true, + c_args : '-DBUILDING_SUB=2') t = executable('simpletest', 'simpletest.c', include_directories : i, link_with : l) test('plain', t) diff --git a/test cases/common/49 subproject/subprojects/sublib/sublib.c b/test cases/common/49 subproject/subprojects/sublib/sublib.c index 7045c616f..c13326b85 100644 --- a/test cases/common/49 subproject/subprojects/sublib/sublib.c +++ b/test cases/common/49 subproject/subprojects/sublib/sublib.c @@ -1,5 +1,5 @@ #include -int subfunc() { +int DLL_PUBLIC subfunc() { return 42; } diff --git a/test cases/common/53 subproject subproject/subprojects/a/a.c b/test cases/common/53 subproject subproject/subprojects/a/a.c index 751749d0d..7ac3e5e57 100644 --- a/test cases/common/53 subproject subproject/subprojects/a/a.c +++ b/test cases/common/53 subproject subproject/subprojects/a/a.c @@ -1,4 +1,15 @@ int func2(); -int func() { return func2(); } +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func() { return func2(); } diff --git a/test cases/common/53 subproject subproject/subprojects/b/b.c b/test cases/common/53 subproject subproject/subprojects/b/b.c index 68e6ab975..a95651bc0 100644 --- a/test cases/common/53 subproject subproject/subprojects/b/b.c +++ b/test cases/common/53 subproject subproject/subprojects/b/b.c @@ -1,3 +1,14 @@ -int func2() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func2() { return 42; } diff --git a/test cases/common/60 install script/meson.build b/test cases/common/60 install script/meson.build index f140dd066..ed415b65f 100644 --- a/test cases/common/60 install script/meson.build +++ b/test cases/common/60 install script/meson.build @@ -1,4 +1,8 @@ project('custom install script', 'c') -meson.set_install_script('myinstall.sh') +if meson.get_compiler('c').get_id() == 'msvc' + meson.set_install_script('myinstall.bat') +else + meson.set_install_script('myinstall.sh') +endif executable('prog', 'prog.c', install : true) diff --git a/test cases/common/62 exe static shared/subdir/shlib.c b/test cases/common/62 exe static shared/subdir/shlib.c index b513e1351..d649c7d24 100644 --- a/test cases/common/62 exe static shared/subdir/shlib.c +++ b/test cases/common/62 exe static shared/subdir/shlib.c @@ -1,3 +1,14 @@ -int shlibfunc() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC shlibfunc() { return 42; } diff --git a/test cases/common/79 shared subproject/subprojects/B/b.c b/test cases/common/79 shared subproject/subprojects/B/b.c index 03b0cc72e..a1f3a5147 100644 --- a/test cases/common/79 shared subproject/subprojects/B/b.c +++ b/test cases/common/79 shared subproject/subprojects/B/b.c @@ -1,7 +1,19 @@ #include +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + + char func_c(); -char func_b() { +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/79 shared subproject/subprojects/C/c.c b/test cases/common/79 shared subproject/subprojects/C/c.c index 3bbac08c9..eebfb9fba 100644 --- a/test cases/common/79 shared subproject/subprojects/C/c.c +++ b/test cases/common/79 shared subproject/subprojects/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/80 shared subproject 2/subprojects/B/b.c b/test cases/common/80 shared subproject 2/subprojects/B/b.c index 03b0cc72e..4c94ee95f 100644 --- a/test cases/common/80 shared subproject 2/subprojects/B/b.c +++ b/test cases/common/80 shared subproject 2/subprojects/B/b.c @@ -1,7 +1,18 @@ #include char func_c(); -char func_b() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/80 shared subproject 2/subprojects/C/c.c b/test cases/common/80 shared subproject 2/subprojects/C/c.c index 3bbac08c9..eebfb9fba 100644 --- a/test cases/common/80 shared subproject 2/subprojects/C/c.c +++ b/test cases/common/80 shared subproject 2/subprojects/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c index 03b0cc72e..4c94ee95f 100644 --- a/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c +++ b/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c @@ -1,7 +1,18 @@ #include char func_c(); -char func_b() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c index 3bbac08c9..eebfb9fba 100644 --- a/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c +++ b/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/86 same basename/lib.c b/test cases/common/86 same basename/lib.c index 11ce3b3f9..6fd432e50 100644 --- a/test cases/common/86 same basename/lib.c +++ b/test cases/common/86 same basename/lib.c @@ -1,5 +1,16 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + #if defined SHAR -int func() { +int DLL_PUBLIC func() { return 1; } #elif defined STAT