Thanks for the example. I've found a bug in the memory allocator and fixing that allows your example to complete. The memory allocator was the last bit I did so hadn't had the same amount of testing as the rest of the code.
David
On 10/10/2015 10:15, Artella Coding wrote:
Hi, I am also finding that code segfaults when the ffi functions are used in a loop. For example in the following I create a large array, and I can easily set and then get the 1000th element (compile code below without "val () = loop (pData);" in the main function). However when the ffi functions are used in a loop, the code segfaults around setting and getting the 78th element. The code is messy & I dont properly deallocate the array, but it is just for illustration. The instructions I am using to create the shared library are at the top of the c file.