aboutsummaryrefslogtreecommitdiffstats
path: root/libusb/libusb.h
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-07-10 17:51:13 -0600
committerDaniel Drake <dan@reactivated.net>2010-07-27 20:57:20 -0600
commit9a4249f8a104b98a15a7e3ba7ecae9a385ed9027 (patch)
treeb9cc7a54a839fdb9be688469c18fe3918634530e /libusb/libusb.h
parentd38dd5e3d2a872f7064eea084ddea8c33811dd7d (diff)
downloadandroid_external_libusbx-9a4249f8a104b98a15a7e3ba7ecae9a385ed9027.tar.gz
android_external_libusbx-9a4249f8a104b98a15a7e3ba7ecae9a385ed9027.tar.bz2
android_external_libusbx-9a4249f8a104b98a15a7e3ba7ecae9a385ed9027.zip
Add Windows support
Via Cygwin/MinGW, libusb now has windows support. Thanks to contributors: Michael Plante, Orin Eman, Peter Stuge, Stephan Meyer, Xiaofan Chen.
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r--libusb/libusb.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index 9f298d3..5c88d73 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -21,15 +21,32 @@
#ifndef __LIBUSB_H__
#define __LIBUSB_H__
+/* MSVC doesn't like inline, but does accept __inline ?? */
+#ifdef _MSC_VER
+#define inline __inline
+#endif
+
#include <stdint.h>
#include <sys/types.h>
#include <time.h>
#include <limits.h>
-#if defined(__linux) || defined(__APPLE__)
+#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
#include <sys/time.h>
#endif
+/* 'interface' might be defined as a macro on Windows, so we need to
+ * undefine it so as not to break the current libusb API, because
+ * libusb_config_descriptor has an 'interface' member
+ * As this can be problematic if you include windows.h after libusb.h
+ * in your sources, we force windows.h to be included first. */
+#if defined(_WIN32) || defined(__CYGWIN__)
+#include <windows.h>
+#if defined(interface)
+#undef interface
+#endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif