projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.nguyen.vg/SXSI/xpathcomp
[SXSI/xpathcomp.git]
/
src
/
common_stub.hpp
diff --git
a/src/common_stub.hpp
b/src/common_stub.hpp
index
ad15256
..
b771f33
100644
(file)
--- a/
src/common_stub.hpp
+++ b/
src/common_stub.hpp
@@
-1,5
+1,5
@@
-#ifndef COMMON_STUB_H_
-#define COMMON_STUB_H_
+#ifndef COMMON_STUB_H
PP
_
+#define COMMON_STUB_H
PP
_
extern "C" {
#define CAML_NAME_SPACE
extern "C" {
#define CAML_NAME_SPACE
@@
-13,9
+13,15
@@
extern "C" {
#include <caml/bigarray.h>
}
#include <typeinfo>
#include <caml/bigarray.h>
}
#include <typeinfo>
+#include <cstdio>
+#include <cassert>
#define NoAlloc
#define NoAlloc
+//Must be used in front of every function that is called from OCaml.
+
+#define ML_BINDING extern "C" __attribute__ ((force_align_arg_pointer))
+
void register_custom_(char* name,
size_t size,
void register_custom_(char* name,
size_t size,
@@
-25,6
+31,7
@@
value alloc_custom_(char* name);
template <class X> X& Obj_val(value v)
{
template <class X> X& Obj_val(value v)
{
+ assert(Tag_val(v) == Custom_tag);
return * (X*) Data_custom_val(v);
}
return * (X*) Data_custom_val(v);
}
@@
-55,8
+62,7
@@
sxsi_alloc_custom(void (*finalize)(value) = sxsi_finalize_custom<X>)
void sxsi_raise_msg(const char * msg);
void sxsi_raise_msg(const char * msg);
-extern "C" value sxsi_cpp_init(value unit);
-
+ML_BINDING value sxsi_cpp_init(value unit);
#endif
#endif