AW: New UFFI version (0.2.10) available

"Hoehle, Joerg-Cyril" <[email protected]> Wed, 20 Mar 2002 10:39:22 +0100
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
Hi,

> -----Ursprungliche Nachricht-----
> Von: Kevin Rosenberg [mailto:kevin-HJRc7zDS/[email protected]]
> Gesendet: Dienstag, 19. Marz 2002 17:50
> An: UFFI-Users List
> Betreff: [UFFI-Users] New UFFI version (0.2.10) available
> 
> 
> I've released a new version that fixes the variance in signed/unsigned
> in foreign-strings. With this, all examples now work on CMUCL.
> 
> I added a section on design priority to the manual. You can 
> browse this 
> section of the manual online:
>   http://uffi.med-info.com/manual/x91.htm#AEN99
> 
> I recommend reading this section and I request comments on 
> this section.
> There are some very basic design choices in achieving 
> cross-implementation
> compatible code. Basically, I'm choosing implementation-specific
> optimizations at the expense of programmer convenience. Let 
> me know if you
> agree or disagree with this choice.

http://uffi.med-info.com/manual/r1052.htm
  (check-type key string)
  (with-cstring (key-cstring key)
    (convert-from-cstring (c-getenv key-cstring))))

http://uffi.med-info.com/manual/r1230.htm
(def-function "gethostname" 
  ((name :cstring)
   (len :int))
  :returning :int)

Could you please show how to use this function?

I believe one must allocate a garbage string so as to be able to call convert-from-cstring and with-cstring, as name is a pure :out parameter.

(let ((unused-storage (make-string 64))) ; 64 on Linux, 256 on Solaris...
  (with-cstring (name unused-storage)
    (if (zerop (call-"gethostname" name 64))
       (convert-from-cstring name))))