[cffi-devel] cffi-grovel on windows 7

Anton Kovalenko anton at sw4me.com
Wed Nov 30 20:28:00 UTC 2011


Luís Oliveira <luismbo at gmail.com> writes:

>> When I tried to load the osicat library via quicklisp yesterday i got an
>> error because the cffi-groveler couldn't find the c compiler and because the
>> path in the include parameter was ill formed (the drive letter was missing).
>
> Regarding the first issue, unless Windows has some new concept of a
> default system compiler, I guess all we can do is look for more likely
> places. Right now, it's looking at "c:/msys/1.0/bin/gcc.exe". Perhaps
> it could do better than that.

Windows has no concept of a default system compiler (for C compilers, at
least). While there can be better strategies to find it, it's very
important to try gcc.exe from PATH as the first attempt; every more
likely place should be tried after that one.

While it's fine to surprise users by doing the right thing, it's more
important to allow a *predictable* right thing to happen if the system
is rightly configured. A good user will ensure that GCC.EXE is in the
PATH whenever he expects some software to use gcc.

> What include parameter are you referring to? Do you have a patch?

One place that is obviously wrong is that (format nil "I~A"
(directory-namestring ...)) in grovel.lisp. It's pretty common in modern
Lisp code, and it *screams* "WE DON'T CARE ABOUT WINDOWS". I'll look
deeper for other similar things. Btw, isn't it about time to just stop
writing code like that? Even ASDF knows something about
PATHNAME-DEVICEs (in its peculiar ad-hoc manner that shouldn't be
replicated, of course).

> Osicat is probably the best test-case for cffi-grovel on Windows.
> There's also a port of iolib to Windows:
> <http://src.knowledgetools.de/tomas/winapi/index.html>.

The port of IOLIB, fortunately, doesn't rely on grovel when run on
Windows (all grovel entries are reader-conditioned away). Generally,
it's a perfect strategy for system APIs and a good thing to do for many
libraries: you just replicate structure definitions and rely on them
being stable (or upgraded in a compatible way, which is much easier when
most of them have cbSize component). All platform's "subculture" is
against grovelling, unlike the Unix one.

-- 
Regards, Anton Kovalenko <http://github.com/akovalenko/sbcl-win32-threads/wiki>
+7(916)345-34-02 | Elektrostal' MO, Russia





More information about the cffi-devel mailing list