diff options
-rw-r--r-- | test cases/d/10 d cpp/cppmain.cpp | 12 | ||||
-rw-r--r-- | test cases/d/10 d cpp/libfile.d | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/test cases/d/10 d cpp/cppmain.cpp b/test cases/d/10 d cpp/cppmain.cpp index aeddf56..ff90e3f 100644 --- a/test cases/d/10 d cpp/cppmain.cpp +++ b/test cases/d/10 d cpp/cppmain.cpp @@ -1,6 +1,18 @@ +extern "C" int rt_init(); +extern "C" int rt_term(); extern void print_hello(int i); int main(int, char**) { + // initialize D runtime + if (!rt_init()) + return 1; + print_hello(1); + + // terminate D runtime, each initialize call + // must be paired with a terminate call. + if (!rt_term()) + return 1; + return 0; } diff --git a/test cases/d/10 d cpp/libfile.d b/test cases/d/10 d cpp/libfile.d index 7c4a449..88cb53e 100644 --- a/test cases/d/10 d cpp/libfile.d +++ b/test cases/d/10 d cpp/libfile.d @@ -1,5 +1,5 @@ -import core.stdc.stdio; +import std.stdio; extern (C++) void print_hello(int i) { - printf("Hello. Here is a number printed with D: %d\n", i); + writefln("Hello. Here is a number printed with D: %d", i); } |