|
From: 25an <man...@gm...> - 2007-05-28 11:19:48
|
I changed in the usb.h file
/* ensure byte-packed structures */
#pragma pack(1)
#pragma pack(push)
#pragma pack(pop)
//#include <pshpack1.h>
This made it work but I got some warnings that I have not yet managed to
solve I guess it have something to do how I am using the pragma I have not
figured out how the pragma pack works.
Dan Martins-2 wrote:
>
> I have this:
>
> windows xp service pack 2
> borland c++ builder version 6.0 (build 10.157)
> libusb-win32 0.1.12.1
>
> the thing is the precompiled program works fine with the hardware, giving
> me
> all the info I can't get when I try to compile the program myself. that's
> why I think it's a problem with the compiler. any ideas? thanks in
> advance.
>
> Dan Leite Martins
>
>
> On 4/3/07, Stephan Meyer <ste...@we...> wrote:
>>
>>
>> This sound like an alignment problem.
>> Some BC6 versions had serious bugs in the pshpack*.h files.
>> Do you have the latest service pack installed?
>>
>> Stephan
>>
>>
>> >
>> > Hi there,
>> >
>> >
>> > When trying to compile the example program [testlibusb_win.c], I get an
>> error when I try to access the variables of the struct
>> usb_config_descriptor
>> > , which is been pointed by the variable struct usb_device *dev. The
>> function,
>> >
>> >
>> > for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
>> > print_configuration(&dev->config[i]);
>> >
>> >
>> > passes a valid memory address, but all of its values are NULL. So when
>> I
>> try to run this function,
>> >
>> >
>> >
>> > static void print_configuration(struct usb_config_descriptor *config)
>> > {
>> > int i;
>> >
>> > edit_printf(" wTotalLength: %d\r\n",
>> config->wTotalLength);
>> >
>> > edit_printf(" bNumInterfaces: %d\r\n",
>> config->bNumInterfaces);
>> > edit_printf(" bConfigurationValue: %d\r\n",
>> config->bConfigurationValue);
>> > edit_printf(" iConfiguration: %d\r\n",
>> config->iConfiguration);
>> >
>> > edit_printf(" bmAttributes: %02xh\r\n",
>> config->bmAttributes);
>> > edit_printf(" MaxPower: %d\r\n", config->MaxPower);
>> >
>> >
>> > for (i = 0; i < config->bNumInterfaces; i++)
>> > print_interface(&config->interface[i]);
>> > }
>> >
>> >
>> > it stops on this line,
>> >
>> >
>> > edit_printf(" wTotalLength: %d\r\n", config->wTotalLength);
>> >
>> >
>> >
>> > giving the following error message:
>> >
>> >
>> > Project raised exception EAccessViolation with message 'Access
>> violation at address 00401A82. Read of address 00000035'. Process
>> stopped.
>> >
>> >
>> >
>> > the address 00000035 is owned by the variable the program tried to
>> access, config->wTotalLength.
>> >
>> >
>> > If I don't use this struct, the program runs fine, but I don't get all
>> the info the pre-compiled program gets, only Bus, Device, Vendor ID,
>> Product
>> ID, Manufacturer and Product.
>> >
>> >
>> > Do you have an idea of why this is happening? Could be the compiler's
>> fault? I'm using Borland C++ Builder 6's compiler. Any comments will be
>> very
>> welcomed. Thanks in advance,
>> >
>> >
>> > Dan Leite Martins
>> >
>> > -----------------------------------------------------------------
>> >
>> -------------------------------------------------------------------------
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> > opinions on IT & business topics through brief surveys-and earn cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >
>> > -----------------------------------------------------------------
>> > _______________________________________________
>> > Libusb-win32-devel mailing list
>> > Lib...@li...
>> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>> >
>>
>>
>> _______________________________________________________________
>> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
>> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Libusb-win32-devel mailing list
>> Lib...@li...
>> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Libusb-win32-devel mailing list
> Lib...@li...
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>
>
--
View this message in context: http://www.nabble.com/Error-compiling-test-program-tf3508594.html#a10834691
Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com.
|