Problem with _WIN32 preprocessor symbol and libusb

Cliff Hones
Fri Mar 22 19:34:00 GMT 2013

The libusb package uses the presence of _WIN32 to determine which
calling convention to use for the library externals - if _WIN32 is
defined it uses WINAPI.  [See /usr/include/libusb-1.0/libusb.h.]

There is of course the question of whether it is/was sensible to use
WINAPI when the package is compiled for Cygwin, but (as the header
points out) this doesn't really matter as long as the same is
used for compiling the library and compiling user applications.

Unfortunately the default has been changed recently.  _WIN32 used to
be defined by default in the Cygwin environment (so the current
libusb package is using WINAPI), but some time between last December
and now this was changed so _WIN32 is no longer defined.  I see from
mail archives this was intentional - but it has unfortunately broken
usage of libusb.

I assume the absence of _WIN32 is permanent, in which case libusb
needs to be reissued.

Note - there is of course a trivial workaround until libusb is reissued -
simply define _WIN32 explicitly in any source including libusb.h.

-- Cliff

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list