[cffi-devel] Re: First usages of CFFI

Marko Tapio Manninen mmstud at gmail.com
Tue Jun 17 21:25:45 UTC 2008


Thanks you for help. That made a trick. I managed to create a small  
server that responds well with cffi and libevent now.

-Marko

Stephen Compall kirjoitti 17.6.2008 kello 20.07:

> Marko Tapio Manninen <mmstud at gmail.com> writes:
>
>> Thank you for comments. I have advanced with this (actually almost
>> ready compared to my starting point), but still im getting an error,
>> when server is running and i am trying to get response from it.
>
> Note the return type here:
>
>> (defcfun ("evhttp_send_reply" %evhttp-send-reply) :void
>>  (req evhttp-request)
>>  (flag :int)
>>  (msg :string)
>>  (buf evbuffer))
>>
>> ;;; unwind-protect to create evbuffer-new???
>>
>> (defcallback generic-handler :pointer ((req :pointer) (arg :pointer))
>>  (let ((buf (%evbuffer-new)))
>>    (if (null buf)
>> 	(format t "Failed to create response buffer")
>> 	(progn
>> 	  (%evbuffer-add-printf buf "Requested: %sn" (%evhttp-request-uri  
>> req))
>> 	  (%evhttp-send-reply req HTTP_OK "OK" buf)))))
>
> what you answer above from this callback, and what you declared the
> return type of the callback to be.
>
> -- 
> But you know how reluctant paranormal phenomena are to reveal
> themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003




More information about the cffi-devel mailing list