13 **ev.d** is both a low and high level libev_ bindings for the `D Programming
16 All modules are placed in the ``ev`` package.
20 libev_ should be compiled with ``EV_MULTIPLICITY=1`` to work with **ev.d**.
24 Low level API (``ev.c``)
25 ========================
27 The low level bindings directly expose the C API, without any specific D magic.
28 You can almost port a simple C libev example changing a few lines of code, for
36 auto loop = ev_default_loop();
37 /* initialise an io watcher, then start it */
38 ev_io_init(&stdin_watcher, &stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
39 ev_io_start(loop, &stdin_watcher);
40 /* loop till timeout or data ready */
44 For a complete example see `ctest.d`__.
46 __ https://git.llucax.com/w/software/ev.d.git/blob/HEAD:/ctest.d
50 High level API (``ev.d``)
51 =========================
53 The high level API adds some D sugar on top of the low level API, providing
54 a more D-ish experience.
56 You can use delegates to handle events and is a little more object oriented.
58 Here is a very simple example::
66 (Timer w, int revents)
68 writefln("timeout, revents = ", revents);
69 w.loop.unloop(Unloop.ONE); // example syntax
75 For a complete example see `dtest.d`__.
77 __ https://git.llucax.com/w/software/ev.d.git/blob/HEAD:/dtest.d
84 You can disable specific watchers types at compile-time (this should be in
85 sync with libev watchers support).
87 To do that, use version ``EV_ENABLE_SELECT`` and then select the specific
88 watchers you want to enable.
90 For example: ``gdc -fversion=EV_ENABLE_SELECT -fversion=EV_STAT_ENABLE`` to
91 enable only the ``ev_stat`` extra watcher.
98 There are no proper releases yet, but mainly because the code is so simple,
99 not because the code is not working or stable enough. You can get the code
100 from the Git_ repository__ (you can get a tarball there too, if you don't have
103 __ https://git.llucax.com/w/software/ev.d.git
110 If you have any problems/comments/suggestions, you can contact me directly at
111 luca@llucax.com. If at any time there is enough people interested in
112 **ev.d** I might open a mailing list for it, but for now it seems overkill to
120 **ev.d** was written by Leandro Lucarella.
127 **ev.d** is placed under the BOLA_ License which is basically Public Domain.
130 .. _libev: http://software.schmorp.de/pkg/libev.html
131 .. _`D Programming Language`: http://www.digitalmars.com/d/
132 .. _BOLA: http://auriga.wearlab.de/~alb/bola/
133 .. _Git: http://git.or.cz/
135 .. vim: set et sw=3 sts=3 tw=78 :