libftdi Archives

Subject: libusb-win32 usb.h and MinGW-w64 usb.h conflict solution

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 21 Sep 2010 13:32:03 +0800
I would like to seek your input for this topic. Right now libftdi has
the header file fdti.h which in turn includes for libusb-win32's usb.h
under Windows. Somehow it conflicts with MinGW-w64's usb.h
(from Microsoft DDK). For MinGW there is not such conflict
since MinGW's DDK usb.h is inside <ddk/usb.h>.

Please refer to the following thread.
http://www.mail-archive.com/mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx/msg01853.html
(start of the discussion)
http://www.mail-archive.com/mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx/msg01883.html
(kind of end of discussion)

To be fair, MinGW-w64 people have a point as well. I also wish libusb-0.1
and libusb-win32's header were not called usb.h.

Since MinGW-w64 people decide not to change, what is the way to
deal with this for projects using libusb-win32, like libftdi?

Potential solution for libftdi or other projects using libusb-win32
http://www.mail-archive.com/mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx/msg01916.html
+++++++++++++++++++++++++++
I see. So the proper solution is something like this.
1) Ask the user to put libusb-win32 usb.h inside
a separate directory, say MinGW-w64 include\libusb-win32\usb.h
and put the import library libusb.a in MinGW-w64's lib folder.
2) Ask the user to include proper -I directive to include the
libusb-win32 usb.h instead of MinGW-w64 usb.h
3) If the user needs both, then he can use the above
and then use  #include_next to include mingw-w64 usb.h.

Right now I do not think there are really many users of
case 3).

Asking the users to do 1) and 2) will probably take
some time. I will check with libftdi and OpenOCD
projects first.

For MinGW users who use libusb-win32, typically
they will just put libusb-win32 usb.h in the include
directory and libusb.a in the lib directory. So this
practice needs to be changed as well.

All in all, it will probably take some time for projects
to be changed. It is not that simple after all since
it is out of our control.
++++++++++++++++

For libftdi, the other solution is to move up to libftdi-1.0
which will use libusb-1.0's header file "libusb.h".

Yet other "not-so-proper" solution is to ask users
of MinGW-w64 to change the name of MinGW-w64
usb.h to a different name and put libusb-win32's
usb.h in place.

What is your preference?


-- 
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • libusb-win32 usb.h and MinGW-w64 usb.h conflict solution, Xiaofan Chen <=