I am using setFinal to free a string (char *) whose pointer is returned via a parameter (char **) with address/deref to construct/destruct the char ** parameter. Unfortunately, I cannot get this to work.

It seems that a function registered with setFinal is not always passed the C pointer (of the vol) that it was registered with, in particular, when the vol supplied to setFinal is derived from address/deref. E.g.

   setFinal mycfun (deref (address v))

does not call mycfun with the same C pointer as for

   setFinal mycfun v

This seems like an issue to me but perhaps I have misunderstood something.

The attached example in eg1.tar.gz demonstrates this.  After unpacking,

   cd eg1/
   make bin  # build eg1.so
   LD_LIBRARY_PATH=.: poly < eg1.sml  # change glibc name if req.

See eg1.sml for details.

I have tried Poly/ML versions as follows:

  5.4   x86_64
  5.4.1 x86_64
  5.4   i386
  r1352 i386

and all have this pointer mismatch. (With i386, the pointer passed to the C function is null whereas it is some nearby pointer with x86_64.)

Phil

Attachment: eg1.tar.gz
Description: GNU Zip compressed data

_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to