cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fwd: Re: Close callback

From: Ingo Krabbe <ikrabbe.ask_at_web.de>
Date: Thu, 6 Mar 2008 18:31:18 +0100

Am Donnerstag, 6. März 2008 18:01:43 schrieb Dan Fandrich:
> On Thu, Mar 06, 2008 at 01:13:21PM +0100, Ingo Krabbe wrote:
> > Following situation: LibcURL in a qt event loop.
>
> Can what you're writing be generalized for many Qt apps? I know some
> people would be interested in a generic Qt "binding" for libcurl to make it
> easier to use in Qt apps.
>

Actually I don't use the qt library directly. I have an abstraction layer
that is driven by qt in my project, but can transparently be changed into
glib or any other event loop that provides asynchronous IO events.

So my writing can not only be generalized for qt event loops but for nearly
any event loop.

I might even be able to provide such an abstraction layer to export a libcURL
binding for event loop machines, though my current abstraction layer is quite
complex and might not be easier to use for most people, who don't want to
work more with this library.

(I use a system, that creates a so called program_record for each program.
This program_record will be initialized with set_value(pr,name,value) and
get_value(pr,name) functions where pr=program_record, name is a const char*
and value is an opaque void*.
These functions use a hashtable mapping to store global values by name. In my
project I use a QHash for example. Again I have implemented this mechanism
for glib too.
Next I register two functions with name "register io" and "destroy io".
Register gets (fd,type,data,func) and returns an io function (iof) pointer
that is opaque. (For qt this parameter will contain a Child of
QSocketNotifier)
The function is always void(*func)(void* iof, void* dat, int fd);)

So I can register system/project specialized functions that do asynchronous IO
and retranslate the parameters for my interface. Actually this will work
with any System, where the file handle reference fits into an int. I think
this will be all systems.

The utilization of this code to use the libcURL API is now simple, when I use
your multi_socket functions.
Received on 2008-03-06