summaryrefslogtreecommitdiffstats
path: root/llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-08 19:32:27 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-08 19:32:27 +0000
commitf11976538eb1d4dd85ac305aa3e936c1cfeb4f6d (patch)
treef29a18cb2c0b9f8a168869e9841d07d96eef7023 /llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c
parentb8c11eb36b72daae0ee6089d00f592027a68d550 (diff)
downloadbcm5719-llvm-f11976538eb1d4dd85ac305aa3e936c1cfeb4f6d.tar.gz
bcm5719-llvm-f11976538eb1d4dd85ac305aa3e936c1cfeb4f6d.zip
Add OCaml tutorial to the examples.
llvm-svn: 97966
Diffstat (limited to 'llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c')
-rw-r--r--llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c b/llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c
new file mode 100644
index 00000000000..90faed15813
--- /dev/null
+++ b/llvm/examples/OCaml-Kaleidoscope/Chapter7/bindings.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+/* putchard - putchar that takes a double and returns 0. */
+extern double putchard(double X) {
+ putchar((char)X);
+ return 0;
+}
+
+/* printd - printf that takes a double prints it as "%f\n", returning 0. */
+extern double printd(double X) {
+ printf("%f\n", X);
+ return 0;
+}
OpenPOWER on IntegriCloud