What's the use of SWIG and other interface/stub generators?

"Hoehle, Joerg-Cyril" <[email protected]> Fri, 13 Dec 2002 18:29:06 +0100
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
I'm serious,

here's what I believe SWIG etc. become to see:
     int gethostname(char *name, int namelen);

How can they possibly transform this into
(uffi:def-function ("gethostname" c-gethostname)
    ((name (* :unsigned-char))
     (len :int))
  :returning :int)
instead of (name :cstring)?
How can SWIG et al. know?

Obviously SWIG would have to RTFM ;)

My point is that, since one needs to RTFM anyway, why not be even more precise, e.g. specify :in/out, array sizes etc., as in:

(def-c-call-out c-gethostname
    (:arguments (name (c-ptr (c-array-max char #.MAXHOSTNAMELEN)) :out :alloca)
                (len size_t))
  (:return-type int))

IMHO, SWIG just can't cut it (I never tried it out though). So I wonder what people's interest and heat for SWIG and other .h->(U)FFI translators is.

Regards,
	Jörg Höhle