diff options
author | Art Yerkes <ayerkes@speakeasy.net> | 2003-03-10 04:14:04 +0000 |
---|---|---|
committer | Art Yerkes <ayerkes@speakeasy.net> | 2003-03-10 04:14:04 +0000 |
commit | de9c786cad8461c6ccd821dc6bd54bab95baebbc (patch) | |
tree | 9785a80cffae25b39119f89cb3b3beb80e6c4f03 /Lib/ocaml/director.swg | |
parent | 92ff18c46e838f5500a2a72bd32eba877bce25ac (diff) | |
download | swig-de9c786cad8461c6ccd821dc6bd54bab95baebbc.tar.gz |
Working example. See Examples/ocaml/shapes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4489 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/ocaml/director.swg')
-rw-r--r-- | Lib/ocaml/director.swg | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/ocaml/director.swg b/Lib/ocaml/director.swg index ca190a25f..0f7e51569 100644 --- a/Lib/ocaml/director.swg +++ b/Lib/ocaml/director.swg @@ -91,10 +91,12 @@ public: /* wrap a ocaml object, optionally taking ownership */ __DIRECTOR__(value self, int disown): _self(self), _disown(disown) { + register_global_root(&_self); } /* discard our reference at destruction */ virtual ~__DIRECTOR__() { + remove_global_root(&_self); __disown(); // Disown is safe here because we're just divorcing a reference that // points to us. @@ -102,7 +104,7 @@ public: /* return a pointer to the wrapped ocaml object */ value __get_self() const { - return _self; + return callback(*caml_named_value("caml_director_get_self"),_self); } /* get the _up flag to determine if the method call should be routed @@ -188,7 +190,7 @@ let new_derived_object cfun x_class args = let obj = cfun (match args with C_list argl -> - (C_list ((C_obj new_class) :: argl)) + (C_list ((C_director_core (C_obj new_class,ob_ref)) :: argl)) | a -> (C_list [ C_director_core (C_obj new_class,ob_ref) ; a ])) in ob_ref := Some obj ; |