diff options
author | Rosen Penev <rosenp@gmail.com> | 2022-06-26 13:28:58 -0700 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2022-09-04 21:10:40 +0200 |
commit | 5c27abd59ead601177c724a87568e20e87861878 (patch) | |
tree | 7284741164772baaeeabd9c1b3afb87cb0724203 | |
parent | 687bf21a7dde218514c5e6508d0cb8da2071cf3c (diff) | |
download | libusb-5c27abd59ead601177c724a87568e20e87861878.tar.gz |
windows: Mark libusb_set_option as WINAPIV
WINAPI evaluates to __stdcall, which does not work with variadic
functions. MSVC and MinGW implicitly demote this to __cdecl (clang does
too and also warns about it). Instead of having this implicit, make it
explicit.
Closes #1160
Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r-- | libusb/core.c | 2 | ||||
-rw-r--r-- | libusb/libusb.h | 4 | ||||
-rw-r--r-- | libusb/libusbi.h | 1 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/libusb/core.c b/libusb/core.c index d4f4d9f..db13725 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -2185,7 +2185,7 @@ void API_EXPORTED libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, * on this platform * \returns \ref LIBUSB_ERROR_NOT_FOUND if LIBUSB_OPTION_USE_USBDK is valid on this platform but UsbDk is not available */ -int API_EXPORTED libusb_set_option(libusb_context *ctx, +int API_EXPORTEDV libusb_set_option(libusb_context *ctx, enum libusb_option option, ...) { int arg = 0, r = LIBUSB_SUCCESS; diff --git a/libusb/libusb.h b/libusb/libusb.h index 2b49b41..bc7ef16 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -120,8 +120,10 @@ typedef SSIZE_T ssize_t; */ #if defined(_WIN32) || defined(__CYGWIN__) #define LIBUSB_CALL WINAPI +#define LIBUSB_CALLV WINAPIV #else #define LIBUSB_CALL +#define LIBUSB_CALLV #endif /* _WIN32 || __CYGWIN__ */ /** \def LIBUSB_API_VERSION @@ -2132,7 +2134,7 @@ enum libusb_option { LIBUSB_OPTION_MAX = 3 }; -int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...); +int LIBUSB_CALLV libusb_set_option(libusb_context *ctx, enum libusb_option option, ...); #ifdef _MSC_VER #pragma warning(pop) diff --git a/libusb/libusbi.h b/libusb/libusbi.h index c2b9a6b..e399666 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -128,6 +128,7 @@ typedef atomic_long usbi_atomic_t; * return_type LIBUSB_CALL function_name(params); */ #define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY +#define API_EXPORTEDV LIBUSB_CALLV DEFAULT_VISIBILITY #ifdef __cplusplus extern "C" { diff --git a/libusb/version_nano.h b/libusb/version_nano.h index dbc187b..69f515c 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11745 +#define LIBUSB_NANO 11746 |