Introduced calling convention (for Windows)

Under Windows, a variety of compilers and configurations are available,
meaning that the manner of parameter passing (e.g. registers vs stack)
can vary.

Match the Windows API calling convention and document this appropriately.
This calling convention will be used regardless of the configuration of
the user's development platform.

The only user-level complication is that all functions used as libusb
callbacks must use the same calling convention as libusb. The
LIBUSB_CALL macro is provided to make this easy.

Signed-off-by: Michael Plante <michael.plante@gmail.com>
Signed-off-by: Pete Batard <pbatard@gmail.com>
[dsd: slight change of strategy, add documentation]
This commit is contained in:
Pete Batard 2010-08-13 11:59:49 +01:00 committed by Daniel Drake
parent be523f1fe7
commit 29f9f9e3af
10 changed files with 196 additions and 124 deletions

View file

@ -178,7 +178,7 @@ static int set_mode(unsigned char data)
return 0;
}
static void cb_mode_changed(struct libusb_transfer *transfer)
static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "mode change transfer not completed!\n");
@ -305,7 +305,7 @@ static int next_state(void)
return 0;
}
static void cb_irq(struct libusb_transfer *transfer)
static void LIBUSB_CALL cb_irq(struct libusb_transfer *transfer)
{
unsigned char irqtype = transfer->buffer[0];
@ -343,7 +343,7 @@ static void cb_irq(struct libusb_transfer *transfer)
request_exit(2);
}
static void cb_img(struct libusb_transfer *transfer)
static void LIBUSB_CALL cb_img(struct libusb_transfer *transfer)
{
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr, "img transfer status %d?\n", transfer->status);