Version française
Home     About     Download     Resources     Contact us    
Browse thread
undefined symbol `caml_tuplify2' in dynamic rocaml extension
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jos Backus <jos@c...>
Subject: Re: [Caml-list] undefined symbol `caml_tuplify2' in dynamic rocaml extension (UPDATE)
On Wed, Aug 01, 2007 at 10:59:07AM -0700, Jos Backus wrote:
> On Wed, Aug 01, 2007 at 09:17:02AM -0700, Jos Backus wrote:
> > On Wed, Aug 01, 2007 at 11:16:47AM +0200, Mauricio Fernandez wrote:
> [snip]
> > > If you could pinpoint the conversion that's triggering the problem (and it's
> > > indeed a problem caused by a Ruby <-> OCaml conversion) we'd be one step
> > > away from fixing it.  Have you tried to disassemble the extension and see
> > > where caml_tuplify2 is being called?
> > 
> > I'll have a look. I do see references to caml_tuplify2 in other .a's as well.
> 
> It turns out my extension doesn't call it but one of the required libraries
> does.
> 
> Here's what I am doing:
[snip]

Some good news. We got this to work by creating a kpp.ml file (containing the
Callback.register calls) in the extension directory, and adding some values to
CAML_LIBS, CAML_OBJS and CAML_INCLUDES. Yay!

It looks like we are really close. The next (final?) issue is that we have a
function with signature

    val eval : kpp -> string -> value list -> value list

where

    type value =
	| Vstr of string
	| Vtup of value list

which we want to export to Ruby. We tried:

    Interface.generate(EXT_NAME) do
      value = sym_variant("value") do |t|
	non_constant :Vstr, STRING
	non_constant :Vtup, LIST(t)
      end

      def_class("KPP") do |c|
	t = c.abstract_type
	fun "make", STRING => t
	method "eval", [t, STRING, value] => LIST(STRING)
      end
    end

but it doesn't work (it segfaults inside the extension).

How does one represent `value' on the Ruby side?

Btw, besides having to remove the stray `"' we also found that we had to patch
the kpp_rocaml_wrapper.c to make it compile, basically doing a `%s/t_value
/t_value_/g' in this case.

Hope this feedback is useful. Thanks!

-- 
Jos Backus
jos at catnook.com