Skip Menu |

This queue is for tickets about the Device-USB CPAN distribution.

Report information
The Basics
Id: 26409
Status: resolved
Estimated: 30 min
Worked: 30 min
Priority: 0/
Queue: Device-USB

People
Owner: cpan.wade [...] anomaly.org
Requestors: cpan [...] mikhailov.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.20
Fixed in: 0.21



Subject: Improper usage of Inline_Stack_Vars - cannot compile with VC6
I have tried to compile Device-USB v.0.20 under Windows using VC6 and ActiveState Perl 5.8.8.820 and was getting error C2143 (but it compiled just fine under Linux or FreeBSD). It turns out that macro Inline_Stack_Vars which is used by USB.pm in the middle of function libusb_control_msg() defines some variables. In ANSI C (not C++), you must define all variables at top, and this use violates that rule. Apparently, gcc is forgiving, but VC6 is not. Attached patch fixes this - it moves macro Inline_Stack_Vars to the top of function libusb_control_msg(). With this fix I was able to successfully compile Device::USB and prepare ActiveState ppd package - everything works perfectly now. Please apply this patch to next version. Thanks!
Subject: patch-USB.pm.diff
--- USB-orig.pm Mon Apr 16 10:52:54 2007 +++ USB.pm Mon Apr 16 00:50:56 2007 @@ -622,6 +622,8 @@ int i = 0; int retval = 0; + Inline_Stack_Vars; + if(debugLevel) { printf( "libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n", @@ -634,8 +636,6 @@ { printf( "\t => %d\n",retval ); } - - Inline_Stack_Vars; /* quiet compiler warnings. */ (void)i;
From: GWADEJ [...] cpan.org
Hi Vadim, On Mon Apr 16 14:49:58 2007, mvp wrote: Show quoted text
> I have tried to compile Device-USB v.0.20 under Windows using VC6 and > ActiveState Perl 5.8.8.820 and was getting error C2143 (but it compiled > just fine under Linux or FreeBSD). > It turns out that macro Inline_Stack_Vars which is used by USB.pm in the > middle of function libusb_control_msg() defines some variables. > In ANSI C (not C++), you must define all variables at top, and this use > violates that rule. Apparently, gcc is forgiving, but VC6 is not. > Attached patch fixes this - it moves macro Inline_Stack_Vars to the top > of function libusb_control_msg().
I've applied your patch and re-uploaded version 0.21. It should be available in a few hours. Could you send me a pointer to the ppd? I often get requests from people who are interested in a Windows version. Thanks again. G. Wade
From: cpan [...] mikhailov.org
On Mon Apr 16 20:15:22 2007, GWADEJ wrote: Show quoted text
> Could you send me a pointer to the ppd? I often get requests > from people who are interested in a Windows version.
Thank you for quick update! I have taken your updated version 0.21 and created ppd based on it - see 2 attached files. It was compiled using VC6 (sp5) with libusb-win32 v 0.1.12.1. Use "ppm install Device-USB.ppd" to install on ActivePerl 5.8.8.820. However, I had to install dependent packages "Inline" and "Parse::RecDescent" first - they are available from standard ActiveState repository. For my purposes, this module works great - my Perl script now can turn on/off power on given USB port (for capable hubs, that is). Thank you again for great module, Vadim Mikhailov.
Download Device-USB.ppd
application/octet-stream 483b

Message body not shown because it is not plain text.

Download Device-USB-0.21.tar.gz
application/x-gzip 54.3k

Message body not shown because it is not plain text.