/* * Main program for D compiled code * Hal Perkins 5/28/99, 5/22/00 * * Contents: Standard get and put functions * Main program that evaluates (executes) D program * * This code uses $ in the name of the D main program. This * is not legal in standard C, but is supported by Visual C/C++ */ #include extern int d$main(); /* main function in compiled code */ /* Prompt for input, then return next integer from standard input. */ int get() { int k; printf("get: "); scanf("%d", &k); return k; } /* Write x to standard output with a title and yield value of x */ int put(int x) { printf("put: %d\n", x); return x; } /* Execute D program d$main and print value returned */ void main() { printf("\nValue returned from D main: %d.\n", d$main()); }