1(*===-- llvm_bitwriter.ml - LLVM OCaml Interface --------------*- OCaml -*-===*
2 *
3 *                     The LLVM Compiler Infrastructure
4 *
5 * This file is distributed under the University of Illinois Open Source
6 * License. See LICENSE.TXT for details.
7 *
8 *===----------------------------------------------------------------------===
9 *
10 * This interface provides an OCaml API for the LLVM intermediate
11 * representation, the classes in the VMCore library.
12 *
13 *===----------------------------------------------------------------------===*)
14
15external write_bitcode_file
16  : Llvm.llmodule -> string -> bool
17  = "llvm_write_bitcode_file"
18
19external write_bitcode_to_fd
20  : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool
21  = "llvm_write_bitcode_to_fd"
22
23external write_bitcode_to_memory_buffer
24  : Llvm.llmodule -> Llvm.llmemorybuffer
25  = "llvm_write_bitcode_to_memory_buffer"
26
27let output_bitcode ?unbuffered channel m =
28  write_bitcode_to_fd ?unbuffered m (Unix.descr_of_out_channel channel)
29