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: art yerkes <ayerkes@s...>
Subject: Re: [Caml-list] swig like library...
On Sun, 25 Apr 2004 18:11:00 +0900 (JST)
Yamagata Yoriyuki <yoriyuki@mbg.ocn.ne.jp> wrote:

> From: art yerkes <ayerkes@speakeasy.net>
> Subject: Re: [Caml-list] swig like library...
> Date: Sat, 24 Apr 2004 20:24:43 -0500
> 
> > I agree that the lack of further automation is a bottleneck for SWIG
> > users. I have considered forking some of the core type functions into the
> > ocaml module for that reason.
> 
> I think swig is nice.  It does the supposed job, quick and dirty
> interface to C.
> 
> I have only minor complaints.  First, the access to structure fields
> involves searching assoc lists, using string as a key.  As a result,
> my program spends a lot of time in comparing strings.  A possible and
> easy improvement is making access functions for structure fields
> accessible from the outside.
> 
> Another problem, which may not be a swig problem, is that my program
> occasionally crash.  malloc in a structure creation function (new_*)
> causes seg fault.  Could you give me a suggestion where I have to
> look?

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

You make a good point about method lookup, I will make that faster.
In order to make the accessors for structs available outside the object,
I would have to decorate some names in ugly, and possibly difficult to
remember ways.  I wonder if you (or other SWIG users) have any suggestions
which would eliminate that or make it easier.

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.

I could make member variable accessors different from the methods...
Would that be desirable?
-- 
Hey, Adam Smith, keep your invisible hands to yourself!

-------------------
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