1 (*===-- llvm_bitwriter.mli - LLVM OCaml Interface -------------*- OCaml -*-===*
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
7 *===----------------------------------------------------------------------===*)
11 This interface provides an OCaml API for the LLVM bitcode writer, the
12 classes in the Bitwriter library. *)
14 (** [write_bitcode_file m path] writes the bitcode for module [m] to the file at
15 [path]. Returns [true] if successful, [false] otherwise. *)
16 external write_bitcode_file
17 : Llvm.llmodule
-> string -> bool
18 = "llvm_write_bitcode_file"
20 (** [write_bitcode_to_fd ~unbuffered fd m] writes the bitcode for module
21 [m] to the channel [c]. If [unbuffered] is [true], after every write the fd
22 will be flushed. Returns [true] if successful, [false] otherwise. *)
23 external write_bitcode_to_fd
24 : ?unbuffered
:bool -> Llvm.llmodule
-> Unix.file_descr
-> bool
25 = "llvm_write_bitcode_to_fd"
27 (** [write_bitcode_to_memory_buffer m] returns a memory buffer containing
28 the bitcode for module [m]. *)
29 external write_bitcode_to_memory_buffer
30 : Llvm.llmodule
-> Llvm.llmemorybuffer
31 = "llvm_write_bitcode_to_memory_buffer"
33 (** [output_bitcode ~unbuffered c m] writes the bitcode for module [m]
34 to the channel [c]. If [unbuffered] is [true], after every write the fd
35 will be flushed. Returns [true] if successful, [false] otherwise. *)
36 val output_bitcode
: ?unbuffered
:bool -> out_channel
-> Llvm.llmodule
-> bool