Merge branch 'ZackerySpytz-OCaml-define-CAML_NAME_SPACE'
* ZackerySpytz-OCaml-define-CAML_NAME_SPACE: [OCaml] Define CAML_NAME_SPACE before including caml/ headers
This commit is contained in:
commit
1069cfbfd5
4 changed files with 5 additions and 4 deletions
|
|
@ -108,7 +108,7 @@
|
||||||
%define %cstring_mutable(TYPEMAP,...)
|
%define %cstring_mutable(TYPEMAP,...)
|
||||||
%typemap(in) TYPEMAP {
|
%typemap(in) TYPEMAP {
|
||||||
char *t = String_val($input);
|
char *t = String_val($input);
|
||||||
int n = string_length($input);
|
int n = caml_string_length($input);
|
||||||
$1 = ($1_ltype) t;
|
$1 = ($1_ltype) t;
|
||||||
#if #__VA_ARGS__ == ""
|
#if #__VA_ARGS__ == ""
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ namespace Swig {
|
||||||
public:
|
public:
|
||||||
/* wrap a ocaml object. */
|
/* wrap a ocaml object. */
|
||||||
Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) {
|
Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) {
|
||||||
register_global_root(&swig_self);
|
caml_register_global_root(&swig_self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* discard our reference at destruction */
|
/* discard our reference at destruction */
|
||||||
virtual ~Director() {
|
virtual ~Director() {
|
||||||
remove_global_root(&swig_self);
|
caml_remove_global_root(&swig_self);
|
||||||
swig_disown();
|
swig_disown();
|
||||||
// Disown is safe here because we're just divorcing a reference that points to us.
|
// Disown is safe here because we're just divorcing a reference that points to us.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,7 @@ extern "C" {
|
||||||
SWIGINTERN int caml_string_len( CAML_VALUE v ) {
|
SWIGINTERN int caml_string_len( CAML_VALUE v ) {
|
||||||
switch( SWIG_Tag_val(v) ) {
|
switch( SWIG_Tag_val(v) ) {
|
||||||
case C_string:
|
case C_string:
|
||||||
return string_length(SWIG_Field(v,0));
|
return caml_string_length(SWIG_Field(v,0));
|
||||||
default:
|
default:
|
||||||
return strlen((char *)caml_ptr_val(v,0));
|
return strlen((char *)caml_ptr_val(v,0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ SWIGEXT {
|
||||||
#endif
|
#endif
|
||||||
#define value caml_value_t
|
#define value caml_value_t
|
||||||
#define CAML_VALUE caml_value_t
|
#define CAML_VALUE caml_value_t
|
||||||
|
#define CAML_NAME_SPACE
|
||||||
#include <caml/alloc.h>
|
#include <caml/alloc.h>
|
||||||
#include <caml/custom.h>
|
#include <caml/custom.h>
|
||||||
#include <caml/mlvalues.h>
|
#include <caml/mlvalues.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue