Re: [polyml] Null pointer and comparing CInterface.vol values

2011-11-18 Thread David Matthews
On 18/11/2011 13:49, Phil Clayton wrote: On 17/11/11 19:40, David Matthews wrote: Well, having decided that the existing code is horrible I bit the bullet and investigated libffi more closely. It turns out that it does everything we need including callbacks. I've now modified the foreign-functi

Re: [polyml] CInterface.setFinal pointer mismatch

2011-11-18 Thread Phil Clayton
David, Thanks - I have checked the example on x86_64 and can confirm that it works there too. Phil On 18/11/11 11:48, David Matthews wrote: Phil, Thanks for providing a compact example. I ran the test and found out what was happening. Essentially, if two pointers contained the same value bu

Re: [polyml] Null pointer and comparing CInterface.vol values

2011-11-18 Thread Phil Clayton
On 17/11/11 19:40, David Matthews wrote: On 16/11/2011 20:27, Phil Clayton wrote: On 16/11/11 18:27, David Matthews wrote: On 16/11/2011 18:07, Phil Clayton wrote: Right. Those preprocessor symbols are wrong. I think I changed them elsewhere in the code and somehow those got missed. I think the

[polyml] setFinal important detail

2011-11-18 Thread Phil Clayton
I found an issue with my use of setFinal to free allocated strings that was causing a memory leak. I hadn't appreciated a behavioural detail of setFinal, though it seems obvious now I know. In particular, for setFinal f v, it is (the C value referenced by) v at the time f is called, not at th

Re: [polyml] CInterface.setFinal pointer mismatch

2011-11-18 Thread David Matthews
Phil, Thanks for providing a compact example. I ran the test and found out what was happening. Essentially, if two pointers contained the same value but the finaliser was associated with the later entry in the vol table it was possible that the internal memory used to hold the pointer value