parent
e0120b4586
commit
6e00ab6236
2 changed files with 14 additions and 2 deletions
@ -1,6 +1,18 @@ |
|||||||
|
extern "C" int rt_init(); |
||||||
|
extern "C" int rt_term(); |
||||||
extern void print_hello(int i); |
extern void print_hello(int i); |
||||||
|
|
||||||
int main(int, char**) { |
int main(int, char**) { |
||||||
|
// initialize D runtime
|
||||||
|
if (!rt_init()) |
||||||
|
return 1; |
||||||
|
|
||||||
print_hello(1); |
print_hello(1); |
||||||
|
|
||||||
|
// terminate D runtime, each initialize call
|
||||||
|
// must be paired with a terminate call.
|
||||||
|
if (!rt_term()) |
||||||
|
return 1; |
||||||
|
|
||||||
return 0; |
return 0; |
||||||
} |
} |
||||||
|
@ -1,5 +1,5 @@ |
|||||||
import core.stdc.stdio; |
import std.stdio; |
||||||
|
|
||||||
extern (C++) void print_hello(int i) { |
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); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue