[cffi-devel] trying to make system/posix call on ccl os x and ubuntu...what do I pass to load-foreign-library?

Michael Kohout mwkohout at gmail.com
Fri Aug 21 05:33:57 UTC 2009


Hi all-

I'm a bit of a ffi beginner, and I'm trying to set up a call to getaddrinfo,
as defined by sys/types.h in C.

;;I've modeled the call:
(cffi:defcfun ("getaddrinfo" get-addr-info) :int (hostname :string)(port
:string)(addrinfo :pointer) (results :pointer))


;;and set up the structs:
(cffi:defcstruct addrinfo (ai-flags :int)
         (ai-family :int) (ai-socktype :int) (ai-protocol
:int)(ai-addresslength :int) (socket-address sockaddr)
         (ai-canonname :string) (addrinfo-next :pointer))

;;and the enums
(cffi:defcenum ai-family (:AF_UNSPEC 0) (:AF_INET 2) (:AF_INET6 30))
(cffi:defcenum socktype (:SOCK_STREAM 1))
(cffi:defcenum ai-flags (:AI_PASSIVE 1))


but when I do the call (getaddrinfo "localhost" "80" ai test-pointer) it
isn't resolving.  One thing I haven't done is to call
load-foreign-library(like I've done with non system calls) to set it up the
framework.

Do I have to do this for system calls?  If so, what do I pass to
load-foreign-library to get it to resolve the correct framework or shared
lib(on os x or linux)?
thanks for helping,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20090821/9f0413e5/attachment.html>


More information about the cffi-devel mailing list