aboutsummaryrefslogtreecommitdiff
path: root/bindings/ocaml/bitwriter/llvm_bitwriter.ml
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/ocaml/bitwriter/llvm_bitwriter.ml')
-rw-r--r--bindings/ocaml/bitwriter/llvm_bitwriter.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/bindings/ocaml/bitwriter/llvm_bitwriter.ml b/bindings/ocaml/bitwriter/llvm_bitwriter.ml
index 7b45c53dbf..3e69a3cc8f 100644
--- a/bindings/ocaml/bitwriter/llvm_bitwriter.ml
+++ b/bindings/ocaml/bitwriter/llvm_bitwriter.ml
@@ -16,3 +16,10 @@
(* Writes the bitcode for module the given path. Returns true if successful. *)
external write_bitcode_file : Llvm.llmodule -> string -> bool
= "llvm_write_bitcode_file"
+
+external write_bitcode_to_fd : ?unbuffered:bool -> Llvm.llmodule
+ -> Unix.file_descr -> bool
+ = "llvm_write_bitcode_to_fd"
+
+let output_bitcode ?unbuffered channel m =
+ write_bitcode_to_fd ?unbuffered m (Unix.descr_of_out_channel channel)