<div dir="ltr">The test case is calling a foreign function that creates a ZMQ socket, and calling it twice with the same arguments sets errno. <div><br></div><div>But (with-delayed-interrupts (foreign call) (get errno foreign calL)) always returns 0. As Franz said, this should not be expected to work. </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 8, 2013 at 11:37 PM, Luís Oliveira <span dir="ltr"><<a href="mailto:luismbo@gmail.com" target="_blank">luismbo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Felix Filozov <<a href="mailto:ffilozov@gmail.com">ffilozov@gmail.com</a>> writes:<br>
<br>
> Looking into Allegro CL SMP's manual, there's a macro called<br>
> with-delayed-interrupts, which should prevent interrupts and GC from<br>
> running. However, the wrong errno was still returned when I used this<br>
> macro. I will ask Franz if such a macro exists.<br>
<br>
</div>What's your test case like?<br>
<div class="im"><br>
<br>
> I started exploring your second suggestion. I created an errno<br>
> defstruct (this is what the user passes), in the CFFI package, and I<br>
> tried passing that structure to the CFFI-SYS layer to be modified, but<br>
> then I realized that CFFI-SYS doesn't know anything about the CFFI<br>
> package so it can't modify the structure. So I'm passing a function to<br>
> CFFI-SYS, which gets called with the returned errno value as an<br>
> argument. I don't know if I like this callback mechanism.<br>
<br>
</div>Seems a bit heavy handed, yeah. We can split cffi-sys in two files: a<br>
shared file (with the package define and perhaps that structure<br>
definition) and an implementation-specific file.<br>
<div class="im"><br>
<br>
> Also, while reading through the code I noticed that there's some edge<br>
> cases that would need to be handled. For example %defcfun may make a<br>
> call to foreign-funcall if the argument types and the returns types<br>
> are considered call-by-value. What does that mean?<br>
<br>
</div>We've recently added support for passing structures by value. When that<br>
functionality is needed, we use libffi for invoking the foreign<br>
function. I have no idea how we can reliably get errno in that case.<br>
<div class="im"><br>
<br>
> I also don't quite understand what entry-vec is, if that's something<br>
> that can be ignored for now.<br>
<br>
</div>I don't remember the details, but doc/allegro-internals.txt has some<br>
info about it.<br>
<br>
Cheers,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Luís Oliveira<br>
<a href="http://kerno.org/~luis" target="_blank">http://kerno.org/~luis</a><br>
<br>
<br>
</font></span></blockquote></div><br></div>