Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] swig like library...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: [Caml-list] swig like library...
From: art yerkes <ayerkes@speakeasy.net>
Subject: Re: [Caml-list] swig like library...
Date: Mon, 26 Apr 2004 10:17:46 -0500

> 
> Please send me more details privately about the crash.  That may indeed
> be a bug in my module.

I lost the ocaml part of the code, so I could not help.  (I will
rewrite everything in C) And the problem is hard to reproduce.

However, I found the symptom worsens when I add a finalization
function to a structure.  Does swig pass a C pointer directly to a ml
value, and add its own finalization function to a structure?  This
would corrupt the C heap, and thus explains the symptom.

If any chance swig does like this, then you perhaps would want C
pointers wrapped by custom blocks.

> The simplest way I considered was to have a repository of method names, as
> I do with enum labels:
> 
> type methods_of_foo = [ `Constructor | `Foo | `foo | `_foo | `fOo ... 
>                       | `operatorLessThanOrEqual ]
> 
> And then do the obvious thing in the method call function.  This means
> that code written without camlp4 will be much uglier, and that you may
> have to cast your method names.  The operators will also be uglified.

Assign ids to method names (Polymorphic variant work too), and
associate them to method functions by Hashtbl?  The current design of
"invoke" (?) does not need to change, since invoke will translate a
method name to its id.  Camlp4 could translate a method name to id by
the compilation time as an optimization.

--
Yamagata Yoriyuki

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners