----- Forwarded message from Johan Ur Riise <jo...@riise-data.no> -----
Subject: Re: [cffi-devel] using defcenum keywords in function call Date: Sat, 26 Sep 2009 07:09:49 +0200 From: Johan Ur Riise <jo...@riise-data.no> To: Stelian Ionescu <sione...@cddr.org> On Sat, Sep 26, 2009 at 05:19:15AM +0200, Stelian Ionescu wrote: > > DEFCENUM doesn't define constants(as in C), but a type which gets > translated to integers if you specify it as argument type. In other > words, this is correct: > > (defcfun ("socket" win-socket) socket > "Creates a socket with the overlapped mode as default" > (af af) > (type sock-type) > (protocol pf)) > Thanks, that worked, and I can see now that the curl example shows how to do it. For the record, this definition has a better chance of actually returning a socket: (defcenum af :af-unspec :af-unix :af-inet) (defcenum sock-type (:sock-stream 1) :sock-dgram :sock-raw) (defcenum proto (:tcp 6) (:udp 17)) (defun make-socket () (foreign-funcall "socket" af :af-inet sock-type :sock-stream proto :tcp socket)) ----- End forwarded message ----- _______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel