#include "caml/memory.h"
#include "caml/callback.h"
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
- LLVMDisposeMessage(Message);
-
- raise_with_arg(Prototype, CamlMessage);
- CAMLnoreturn;
-}
-
-/*===-- BitReader --------------------------------------------------------===*/
+void llvm_raise(value Prototype, char *Message);
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
CAMLprim LLVMModuleRef llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
#include "caml/mlvalues.h"
#include "caml/memory.h"
-/*===-- BitWriter ---------------------------------------------------------===*/
-
/* Llvm.llmodule -> string -> bool */
CAMLprim value llvm_write_bitcode_file(LLVMModuleRef M, value Path) {
int Result = LLVMWriteBitcodeToFile(M, String_val(Path));
#include "caml/memory.h"
#include "caml/callback.h"
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
- LLVMDisposeMessage(Message);
-
- raise_with_arg(Prototype, CamlMessage);
- CAMLnoreturn;
-}
+void llvm_raise(value Prototype, char *Message);
/*--... Operations on generic values .......................................--*/
#include "caml/memory.h"
#include "caml/callback.h"
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
- LLVMDisposeMessage(Message);
-
- raise_with_arg(Prototype, CamlMessage);
- CAMLnoreturn;
-}
-
-/*===-- IRReader ----------------------------------------------------------===*/
+void llvm_raise(value Prototype, char *Message);
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
CAMLprim value llvm_parse_ir(LLVMContextRef C,
#include "caml/fail.h"
#include "caml/callback.h"
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
- LLVMDisposeMessage(Message);
-
- raise_with_arg(Prototype, CamlMessage);
- CAMLnoreturn;
-}
+void llvm_raise(value Prototype, char *Message);
/* llmodule -> llmodule -> Mode.t -> unit */
CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src, value Mode) {
#include "caml/fail.h"
#include "caml/callback.h"
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
+value llvm_string_of_message(char* Message) {
+ value String = caml_copy_string(Message);
LLVMDisposeMessage(Message);
- raise_with_arg(Prototype, CamlMessage);
+ return String;
+}
+
+void llvm_raise(value Prototype, char *Message) {
+ CAMLparam1(Prototype);
+ raise_with_arg(Prototype, llvm_string_of_message(Message));
CAMLnoreturn;
}
#include "caml/custom.h"
#include "caml/callback.h"
-/*===---- Exceptions ------------------------------------------------------===*/
-
-static void llvm_raise(value Prototype, char *Message) {
- CAMLparam1(Prototype);
- CAMLlocal1(CamlMessage);
-
- CamlMessage = copy_string(Message);
- LLVMDisposeMessage(Message);
-
- raise_with_arg(Prototype, CamlMessage);
- CAMLnoreturn;
-}
-
-static value llvm_string_of_message(char* Message) {
- value String = caml_copy_string(Message);
- LLVMDisposeMessage(Message);
-
- return String;
-}
+void llvm_raise(value Prototype, char *Message);
+value llvm_string_of_message(char* Message);
/*===---- Data Layout -----------------------------------------------------===*/