X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fcommon_stub.hpp;h=b771f338f16c684c33d705afaa23e6e8cedde7da;hb=29fa227d5418c6346167f3ec46a68bff9f104392;hp=6bfb57d787e30de51fc5ad8401a5de9e5103aec3;hpb=f1181ec507d05a2f9ff5371b282a26f8d6e1ff7e;p=SXSI%2Fxpathcomp.git diff --git a/src/common_stub.hpp b/src/common_stub.hpp index 6bfb57d..b771f33 100644 --- a/src/common_stub.hpp +++ b/src/common_stub.hpp @@ -13,9 +13,15 @@ extern "C" { #include } #include +#include +#include #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, @@ -25,6 +31,7 @@ value alloc_custom_(char* name); template X& Obj_val(value v) { + assert(Tag_val(v) == Custom_tag); return * (X*) Data_custom_val(v); } @@ -55,8 +62,7 @@ sxsi_alloc_custom(void (*finalize)(value) = sxsi_finalize_custom) void sxsi_raise_msg(const char * msg); -extern "C" value sxsi_cpp_init(value unit); - +ML_BINDING value sxsi_cpp_init(value unit); #endif