Le 26/03/2017 à 19:21, Peter Uhnak a écrit :
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.

Ah, ok.


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.

Nono, I didn't mean making UFFI calls via socket (although that would
be interesting), but rather making a C app that would make the calls,
and that would provide a socket interface. (Which is what I typically
do with other langs).

With UFFI and a standard way to marshall types over a socket (ASN.1 or even xml-rpc), this could be generated automatically.

Of course, you may have a few performance issues, but you could have a long-lived child to avoid paying the startup time, and mmap / shared memory to lower the cost of moving memory back and forth.

Thierry

Thanks, Peter




Reply via email to