-#if WIN32
-/* note: the comment below could not be substantiated, but what would I care */
-/* MSDN says this is required to handle SIGFPE */
-volatile double SIGFPE_REQ = 0.0f;
-#endif
+#include "ev_win32.c"
+
+/*****************************************************************************/
+
+static void (*syserr_cb)(const char *msg);
+
+void ev_set_syserr_cb (void (*cb)(const char *msg))
+{
+ syserr_cb = cb;
+}
+
+static void
+syserr (const char *msg)
+{
+ if (!msg)
+ msg = "(libev) system error";
+
+ if (syserr_cb)
+ syserr_cb (msg);
+ else
+ {
+ perror (msg);
+ abort ();
+ }
+}
+
+static void *(*alloc)(void *ptr, long size);
+
+void ev_set_allocator (void *(*cb)(void *ptr, long size))
+{
+ alloc = cb;
+}
+
+static void *
+ev_realloc (void *ptr, long size)
+{
+ ptr = alloc ? alloc (ptr, size) : realloc (ptr, size);
+
+ if (!ptr && size)
+ {
+ fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size);
+ abort ();
+ }
+
+ return ptr;
+}
+
+#define ev_malloc(size) ev_realloc (0, (size))
+#define ev_free(ptr) ev_realloc ((ptr), 0)