On Sun, Dec 12, 2010 at 1:45 AM, Luís Oliveira <luismbo@gmail.com> wrote:

The equivalent CFFI code would be something like:

 (with-foreign-object (p :pointer)
   (getifaddrs p)
   (foreign-slot-value (mem-ref p :pointer) 'ifaddrs 'name))

If you define NAME's type to be :STRING, that code will yield a Lisp string.

That works, thanks

The man page shows that the allocated struct should be free calling freeifaddrs:

void freeifaddrs(struct ifaddrs *ifa);

(freeifaddrs (cffi:mem-ref p :pointer))

is that the correct way to call freeifaddrs?

Regards,
Jose