28 lines · plain
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-exception6 *7 *===----------------------------------------------------------------------===8 *9 * This interface provides an OCaml API for the LLVM intermediate10 * representation, the classes in the VMCore library.11 *12 *===----------------------------------------------------------------------===*)13 14external write_bitcode_file15 : Llvm.llmodule -> string -> bool16 = "llvm_write_bitcode_file"17 18external write_bitcode_to_fd19 : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool20 = "llvm_write_bitcode_to_fd"21 22external write_bitcode_to_memory_buffer23 : Llvm.llmodule -> Llvm.llmemorybuffer24 = "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