1(*===-- llvm_bitwriter.ml - LLVM OCaml Interface --------------*- OCaml -*-===*
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===----------------------------------------------------------------------===
8 *
9 * This interface provides an OCaml API for the LLVM intermediate
10 * representation, the classes in the VMCore library.
11 *
12 *===----------------------------------------------------------------------===*)
13
14external write_bitcode_file
15  : Llvm.llmodule -> string -> bool
16  = "llvm_write_bitcode_file"
17
18external write_bitcode_to_fd
19  : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool
20  = "llvm_write_bitcode_to_fd"
21
22external write_bitcode_to_memory_buffer
23  : Llvm.llmodule -> Llvm.llmemorybuffer
24  = "llvm_write_bitcode_to_memory_buffer"
25
26let output_bitcode ?unbuffered channel m =
27  write_bitcode_to_fd ?unbuffered m (Unix.descr_of_out_channel channel)
28