parent
56823272ab
commit
3eb90414f6
4 changed files with 39 additions and 0 deletions
@ -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…
Reference in new issue