4 <div style="width: 220px; height: 270px; float: right; margin-left: 1em; margin-top: 1em">
5 <iframe width="220" height="270" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141695"></iframe>
20 **ev.d** is both a low and high level libev_ bindings for the `D Programming
23 All modules are placed in the ``ev`` package.
27 libev_ should be compiled with ``EV_MULTIPLICITY=1`` to work with **ev.d**.
31 Low level API (``ev.c``)
32 ========================
34 The low level bindings directly expose the C API, without any specific D magic.
35 You can almost port a simple C libev example changing a few lines of code, for
43 auto loop = ev_default_loop();
44 /* initialise an io watcher, then start it */
45 ev_io_init(&stdin_watcher, &stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
46 ev_io_start(loop, &stdin_watcher);
47 /* loop till timeout or data ready */
51 For a complete example see `ctest.d`__.
53 __ http://git.llucax.com.ar/w/software/ev.d.git/blob/HEAD:/ctest.d
57 High level API (``ev.d``)
58 =========================
60 The high level API adds some D sugar on top of the low level API, providing
61 a more D-ish experience.
63 You can use delegates to handle events and is a little more object oriented.
65 Here is a very simple example::
73 (Timer w, int revents)
75 writefln("timeout, revents = ", revents);
76 w.loop.unloop(Unloop.ONE); // example syntax
82 For a complete example see `dtest.d`__.
84 __ http://git.llucax.com.ar/w/software/ev.d.git/blob/HEAD:/dtest.d
91 You can disable specific watchers types at compile-time (this should be in
92 sync with libev watchers support).
94 To do that, use version ``EV_ENABLE_SELECT`` and then select the specific
95 watchers you want to enable.
97 For example: ``gdc -fversion=EV_ENABLE_SELECT -fversion=EV_STAT_ENABLE`` to
98 enable only the ``ev_stat`` extra watcher.
105 There are no proper releases yet, but mainly because the code is so simple,
106 not because the code is not working or stable enough. You can get the code
107 from the Git_ repository__ (you can get a tarball there too, if you don't have
110 __ http://git.llucax.com.ar/w/software/ev.d.git
117 If you have any problems/comments/suggestions, you can contact me directly at
118 luca@llucax.com.ar. If at any time there is enough people interested in
119 **ev.d** I might open a mailing list for it, but for now it seems overkill to
127 **ev.d** was written by Leandro Lucarella.
134 **ev.d** is placed under the BOLA_ License which is basically Public Domain.
137 .. _libev: http://software.schmorp.de/pkg/libev.html
138 .. _`D Programming Language`: http://www.digitalmars.com/d/
139 .. _BOLA: http://auriga.wearlab.de/~alb/bola/
140 .. _Git: http://git.or.cz/
142 .. vim: set et sw=3 sts=3 tw=78 :