summaryrefslogtreecommitdiff
path: root/bindings/ocaml/bitwriter/bitwriter_ocaml.c
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-06 00:30:06 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-06 00:30:06 +0000
commite623050048e56a512e77c28b69925e7dc1efa6ad (patch)
tree4e7f07dc84a9d5629597884c45591e4089aab801 /bindings/ocaml/bitwriter/bitwriter_ocaml.c
parentb3195fbc2e19755c581eaa3aa52bfc1640c8495a (diff)
downloadllvm-e623050048e56a512e77c28b69925e7dc1efa6ad.tar.gz
llvm-e623050048e56a512e77c28b69925e7dc1efa6ad.tar.bz2
llvm-e623050048e56a512e77c28b69925e7dc1efa6ad.tar.xz
Add a LLVMWriteBitcodeToFD that exposes the raw_fd_ostream options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/bitwriter/bitwriter_ocaml.c')
-rw-r--r--bindings/ocaml/bitwriter/bitwriter_ocaml.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bindings/ocaml/bitwriter/bitwriter_ocaml.c b/bindings/ocaml/bitwriter/bitwriter_ocaml.c
index 41aca259ca..53c93cbdfe 100644
--- a/bindings/ocaml/bitwriter/bitwriter_ocaml.c
+++ b/bindings/ocaml/bitwriter/bitwriter_ocaml.c
@@ -28,3 +28,18 @@ CAMLprim value llvm_write_bitcode_file(value M, value Path) {
int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path));
return Val_bool(res == 0);
}
+
+/* ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool */
+CAMLprim value llvm_write_bitcode_to_fd(value U, value M, value FD) {
+ int Unbuffered;
+ int res;
+
+ if (U == Val_int(0)) {
+ Unbuffered = 0;
+ } else {
+ Unbuffered = Bool_val(Field(U,0));
+ }
+
+ res = LLVMWriteBitcodeToFD((LLVMModuleRef) M, Int_val(FD), 0, Unbuffered);
+ return Val_bool(res == 0);
+}