diff --git a/test cases/d/3 mixed/app.d b/test cases/d/3 mixed/app.d new file mode 100644 index 000000000..6ab5d97d6 --- /dev/null +++ b/test cases/d/3 mixed/app.d @@ -0,0 +1,8 @@ + +extern(C) int printLibraryString(const char *str); + +void main () +{ + immutable ret = printLibraryString ("C foo"); + assert (ret == 3); +} diff --git a/test cases/d/3 mixed/installed_files.txt b/test cases/d/3 mixed/installed_files.txt new file mode 100644 index 000000000..9e7fccc9a --- /dev/null +++ b/test cases/d/3 mixed/installed_files.txt @@ -0,0 +1,4 @@ +usr/bin/appdc_d?exe +usr/lib/libstuff.so +usr/bin/appdc_s?exe +usr/lib/libstuff.a diff --git a/test cases/d/3 mixed/libstuff.c b/test cases/d/3 mixed/libstuff.c new file mode 100644 index 000000000..92d6600ce --- /dev/null +++ b/test cases/d/3 mixed/libstuff.c @@ -0,0 +1,18 @@ +#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 + +#include + +int DLL_PUBLIC printLibraryString(const char *str) +{ + printf("C library says: %s", str); + return 3; +} diff --git a/test cases/d/3 mixed/meson.build b/test cases/d/3 mixed/meson.build new file mode 100644 index 000000000..3dad66d0c --- /dev/null +++ b/test cases/d/3 mixed/meson.build @@ -0,0 +1,9 @@ +project('Mixing C and D', 'd', 'c') + +ldyn = shared_library('stuff', 'libstuff.c', install : true) +ed = executable('appdc_d', 'app.d', link_with : ldyn, install : true) +test('linktest_cdyn', ed) + +lstatic = static_library('stuff', 'libstuff.c', install : true) +es = executable('appdc_s', 'app.d', link_with : lstatic, install : true) +test('linktest_cstatic', es)