On Sun, Mar 26, 2017 at 05:45:04PM +0200, Esteban Lorenzano wrote: > > > On 26 Mar 2017, at 15:40, Peter Uhnak <i.uh...@gmail.com> wrote: > > > > Hi, > > > > is it possible to use UFFI and avoid crashing the image when the called > > code segfaults? > > > > In other words, can I somehow wrap the call and throw in-image > > Exception/Error on failure instead of the whole thing crashing? > > that???s not possible, once you segfault, you segfault. > > > Or is the only way to do that have the called thing running as a separate > > app (e.g. via OSSubProcess) and communicate via pipes or sockets? > > that???s not done. > no idea how much effort is required to implement, but I imagine is not > trivial. >
I have not tried it with FFI calls, but maybe this will do what you want: RemoteTask do: [ 2 + 2 ] ==> 4 Instead of [ 2 + 2 ] use some block containing your FFI calls. It works in Pharo. To get RemoteTask, load OSProcess and CommandShell. You also need Fuel, but I think that is in the image by default. An explanation of RemoteTask is at http://wiki.squeak.org/squeak/6176. You are right, it was not trivial to implement ;-) HTH, Dave