[cffi-devel] Problem with cffi-grovel on windows/cygwin(mingw mode)

Heka Treep zena.treep at gmail.com
Thu Jul 1 06:38:35 UTC 2010


Hi, some problem I have with this:

(defsystem
  ...
  (cffi-grovel:wrapper-file "...")
  ...

generates a call:

gcc -m32 -fPIC -o *.dll *.c -shared

but cygwin want at least flag `-mno-cygwin'. It would be possible to
define this flag in some variable, but the flag is added to the end of
the list of arguments - and it just not work.

I try this format:

gcc cpu-flags cc-flags platform-library-flags* -o output-file input-file

by reimplement `cc-compile-and-link' function:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cffi-grovel)

(defun cc-compile-and-link (input-file output-file &key library)
  (apply #'invoke (or (getenv "CC") *cc*)
         *cpu-word-size-flags*
         `(,@*cc-flags*
           ,@(when library *platform-library-flags*)
           "-o"
           ,(native-namestring output-file)
           ,(native-namestring input-file))))

(setf *cc* "C:/dev/cygwin/bin/gcc-3.exe") ;; its my
(setf *cc-flags* '()) ;; remove -fPIC
(setf *cpu-word-size-flags* "") ;; and this too
(setf *platform-library-flags* '("-mno-cygwin" "-shared")) ;; added
-mno-cygwin in begin
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

It is normal, or I don't understand something?




More information about the cffi-devel mailing list