[cffi-devel] calling getifaddrs
pepone.onrez
pepone.onrez at gmail.com
Sun Dec 12 13:48:50 UTC 2010
On Sun, Dec 12, 2010 at 1:45 AM, Luís Oliveira <luismbo at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20101212/7f43d229/attachment.html>
More information about the cffi-devel
mailing list