summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-06-08 23:31:56 +0100
committerPete Batard <pete@akeo.ie>2012-06-08 23:31:56 +0100
commit6b33cd458921a6023e6e54f3715ead7ed441c648 (patch)
treee51e8cc74d5160241a36e182fd9c0cd62ea6d34d
parenta983fad006fe39a48517e061bf9f66501ff900be (diff)
Windows: Enable MinGW and MSVC DLL interchangeability
* Because we use the WINAPI calling convention, the def file MUST have the @n aliases. There is no way around this as MinGW's .o use decoration always for __stdcall, which can't be turned off. * dlltool must therefore be invoked to create a proper import lib from the .def, using the --kill-at option. * To do that, a CREATE_IMPORT_LIB autotools variable is introduced. * Note: the .def file is currently maintained manually.
-rw-r--r--configure.ac2
-rw-r--r--libusb/Makefile.am9
-rw-r--r--libusb/version_nano.h2
3 files changed, 12 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index b29b2bb..b51555c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,7 @@ case $host in
AC_MSG_RESULT([Windows])
backend="windows"
threads="windows"
+ create_import_lib="yes"
AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
;;
*-cygwin*)
@@ -129,6 +130,7 @@ AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
+AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
if test "$threads" = posix; then
AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
fi
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
index 0e7fc88..4a6859e 100644
--- a/libusb/Makefile.am
+++ b/libusb/Makefile.am
@@ -1,3 +1,5 @@
+all: libusb-1.0.la libusb-1.0.dll
+
lib_LTLIBRARIES = libusb-1.0.la
LINUX_USBFS_SRC = os/linux_usbfs.c
@@ -30,6 +32,13 @@ OS_SRC = $(WINDOWS_USB_SRC)
libusb-1.0.rc: version.h
endif
+libusb-1.0.dll:
+if CREATE_IMPORT_LIB
+# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
+ $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
+endif
+
+
if THREADS_POSIX
THREADS_SRC = os/threads_posix.h os/threads_posix.c
else
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index ee5933f..2e047f4 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10525
+#define LIBUSB_NANO 10526