summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-08-13 11:59:49 +0100
committerDaniel Drake <dan@reactivated.net>2010-08-23 18:48:55 -0600
commit29f9f9e3af3340df6a955881a93caf9d2a6d08d6 (patch)
treee956c2db4aa538c1f83550ee7bd24ca7ceba6f4a /examples
parentbe523f1fe7c136c3fca06ae9c96aff44a22482ba (diff)
downloadlibusb-29f9f9e3af3340df6a955881a93caf9d2a6d08d6.tar.gz
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]
Diffstat (limited to 'examples')
-rw-r--r--examples/dpfp.c6
-rw-r--r--examples/dpfp_threaded.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/dpfp.c b/examples/dpfp.c
index 1970f10..af51e0f 100644
--- a/examples/dpfp.c
+++ b/examples/dpfp.c
@@ -149,7 +149,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");
@@ -276,7 +276,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];
@@ -315,7 +315,7 @@ static void cb_irq(struct libusb_transfer *transfer)
do_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);
diff --git a/examples/dpfp_threaded.c b/examples/dpfp_threaded.c
index c6a0a60..4641a50 100644
--- a/examples/dpfp_threaded.c
+++ b/examples/dpfp_threaded.c
@@ -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);