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;