On Mon, Jan 19, 2009 at 2:31 AM, John Fremlin <j...@msi.co.jp> wrote: > Ideally there would be a way to use the def-foreign-call errno > collection in Allegro CL via CFFI. > > For example, if the foreign-function is trace'd then the > without-interrupts mechanism (sporadically) fails. > > Although it is simple to make a cffi-sys:errno symbol-macro, I think > that logically the errno is only valid immediately after a > foreign-function call.
I'm just trying to follow the usual CFFI philosophy: figure out the minimal CFFI-SYS operations required and implement the rest in the CFFI package. So far that'd be something like: GET-ERRNO, SET-ERRNO and WITHOUT-WHATEVER in CFFI-SYS, and an ERRNO symbol macro in CFFI (optional) and something along the lines of Osicat's ERRNO-WRAPPER. I wonder if you can find out what hoops Allegro has to jump through to ensure errno is right? > The idea that GC must not modify errno must be false on at > least a few implementations ;-) Sounds like we could test that in the test suite. > We should not pretend that it is possible to get errno at an arbitrary > point after a foreign function call. Yeah, but I still haven't fully understood the exact failure cases. Also, it sounds like this sort of thing would be problematic for all sorts of stateful C APIs. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/ _______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel