aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/ocaml/bitwriter/bitwriter_ocaml.c
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/ocaml/bitwriter/bitwriter_ocaml.c')
-rw-r--r--bindings/ocaml/bitwriter/bitwriter_ocaml.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/bindings/ocaml/bitwriter/bitwriter_ocaml.c b/bindings/ocaml/bitwriter/bitwriter_ocaml.c
index a47f700..04fd619 100644
--- a/bindings/ocaml/bitwriter/bitwriter_ocaml.c
+++ b/bindings/ocaml/bitwriter/bitwriter_ocaml.c
@@ -21,25 +21,28 @@
#include "caml/mlvalues.h"
#include "caml/memory.h"
-/*===-- Modules -----------------------------------------------------------===*/
-
/* Llvm.llmodule -> string -> bool */
-CAMLprim value llvm_write_bitcode_file(value M, value Path) {
- int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path));
- return Val_bool(res == 0);
+CAMLprim value llvm_write_bitcode_file(LLVMModuleRef M, value Path) {
+ int Result = LLVMWriteBitcodeToFile(M, String_val(Path));
+ return Val_bool(Result == 0);
}
/* ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool */
-CAMLprim value llvm_write_bitcode_to_fd(value U, value M, value FD) {
+CAMLprim value llvm_write_bitcode_to_fd(value U, LLVMModuleRef M, value FD) {
int Unbuffered;
- int res;
+ int Result;
if (U == Val_int(0)) {
Unbuffered = 0;
} else {
- Unbuffered = Bool_val(Field(U,0));
+ Unbuffered = Bool_val(Field(U, 0));
}
- res = LLVMWriteBitcodeToFD((LLVMModuleRef) M, Int_val(FD), 0, Unbuffered);
- return Val_bool(res == 0);
+ Result = LLVMWriteBitcodeToFD(M, Int_val(FD), 0, Unbuffered);
+ return Val_bool(Result == 0);
+}
+
+/* Llvm.llmodule -> Llvm.llmemorybuffer */
+CAMLprim LLVMMemoryBufferRef llvm_write_bitcode_to_memory_buffer(LLVMModuleRef M) {
+ return LLVMWriteBitcodeToMemoryBuffer(M);
}