Add testcase for mixed C and D compilation

pull/685/head
Matthias Klumpp 8 years ago
parent 56823272ab
commit 3eb90414f6
  1. 8
      test cases/d/3 mixed/app.d
  2. 4
      test cases/d/3 mixed/installed_files.txt
  3. 18
      test cases/d/3 mixed/libstuff.c
  4. 9
      test cases/d/3 mixed/meson.build

@ -0,0 +1,8 @@
extern(C) int printLibraryString(const char *str);
void main ()
{
immutable ret = printLibraryString ("C foo");
assert (ret == 3);
}

@ -0,0 +1,4 @@
usr/bin/appdc_d?exe
usr/lib/libstuff.so
usr/bin/appdc_s?exe
usr/lib/libstuff.a

@ -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 <stdio.h>
int DLL_PUBLIC printLibraryString(const char *str)
{
printf("C library says: %s", str);
return 3;
}

@ -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)
Loading…
Cancel
Save