Fix a nasty bug where the wrong pointer was passed to the C side.
[SXSI/xpathcomp.git] / src / common_stub.hpp
index 47b6dcd..3e874b7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef COMMON_STUB_H_
-#define COMMON_STUB_H_
+#ifndef COMMON_STUB_HPP_
+#define COMMON_STUB_HPP_
 
 extern "C" {
 #define CAML_NAME_SPACE
@@ -13,6 +13,9 @@ extern "C" {
 #include <caml/bigarray.h>
 }
 #include <typeinfo>
+#include <cstdio>
+
+#define NoAlloc
 
 
 void register_custom_(char* name,
@@ -38,7 +41,8 @@ template <class X> void sxsi_finalize_custom(value v)
   sxsi_finalize_obj(Obj_val<X>(v));
 }
 
-template <class X> value sxsi_alloc_custom(void (*finalize)(value) = sxsi_finalize_custom<X>)
+template <class X> value
+sxsi_alloc_custom(void (*finalize)(value) = sxsi_finalize_custom<X>)
 {
   char * name = const_cast<char*>(typeid(X).name());
 
@@ -50,7 +54,7 @@ template <class X> value sxsi_alloc_custom(void (*finalize)(value) = sxsi_finali
   return v;
 }
 
-void sxsi_raise_msg(char * msg);
+void sxsi_raise_msg(const char * msg);
 
 extern "C" value sxsi_cpp_init(value unit);