On Thu, Sep 9, 2010 at 7:50 AM, Xiaofan Chen <[email protected]> wrote:
> On Thu, Sep 9, 2010 at 3:53 AM, Ozkan Sezer <[email protected]> wrote:
>> I made some progress: I checked out branches/libusb-testing/ from
>> your libusb-win32 svn, I tried compiling src/driver/abort_endpoint.c
>> and it succeeded with the following changes:
>>
>> 1. one thing causing the mess was the windows.h include in your own
>> src/usb.h: including windef.h is enough. Including windows.h along
>> with ddk-only headers will pull in winbase.h and the errors you just
>> saw will show up. AFAIK, windows.h should be avoided unless really
>> necessary. You should scan your other sources for it
>>
>> 2. the name of your src/usb.h is, well, usb.h, and it conflicts, ie.
>> searched before the system provided usb.h. Therefore, it must be
>> renamed to something else. For my own tests, I renamed it to
>> usb_private.h and changed all occurences of #include "usb.h" (with
>> quotes) to use the new name.
>>
>> 3. I had to change the order of includes in src/driver/libusb_driver.h
>> to look like the following:
>>
>> #ifdef __GNUC__
>> #include <ddk/ntddk.h>
>> #if !defined(DDKAPI)
>> #define DDKAPI NTAPI
>> #endif
>> #include <usbdi.h>
>> #include "usbdlib_gcc.h"
>> #else
>> .......
>>
>> Note that there is no DDKAPI definition anywhere in the DDK: it only
>> appears in the mingw.org version of headers and it is ancient. New code
>> must use NTAPI (I used the above ifndef above just out of laziness.)
>>
>> 4. To avoid the redeclarations, I changed the ifdef in libusb_driver.h
>> to look like
>>
>> /* some missing defines */
>> #if defined(__GNUC__) && !defined(__MINGW64_VERSION_MAJOR)
>>
>> (because I don't know whether mingw.org have them.)
>>
>> After doing these, I get:
>>
>> $ x86_64-w64-mingw32-gcc -c ./src/driver/abort_endpoint.c -o
>> abort_endpoint.o -O2 -Wall -DWINVER=0x501
>> -DLOG_APPNAME=\"libusb0-sys\" -DTARGETTYPE=DRIVER -I./src
>> -I./src/driver -I/home/ozzie/Download/ddk_test/include
>> -I/home/ozzie/Download/ddk_test/include/ddk -I.
>> In file included from /home/ozzie/Download/ddk_test/include/ddk/ntddk.h:38,
>> from ./src/driver/libusb_driver.h:28,
>> from ./src/driver/abort_endpoint.c:20:
>> /home/ozzie/Download/ddk_test/include/ddk/wdm.h:6669: warning:
>> declaration does not declare anything
>>
>> That warning from wdm.h is just normal. You can avoid it, too, if you
>> use -fms-extensions. Hope these help.
>>
>
> Wow this is great help. I will try your suggestions on other files.
> Thanks a lot!
>
Now it is getting very close. Hopefully you guys have some idea
to fix this last problem. Thanks a lot.
mc...@mcuee-pc-win7 /d/work/mingw-w64/libusb-win32-src-1.2.1.20
$ make driver -i
gcc -c ./src/error.c -o error.o -O2 -Wall -mno-cygwin -DWINVER=0x500 -DLOG_APPN
AME=\"libusb0-sys\" -DTARGETTYPE=DRIVER -I./src -I./src/driver -I./src/ddk -I.
In file included from ./src/ddk/ntddk.h:38:0,
from ./src/error.c:28:
./src/ddk/wdm.h:6669:36: warning: declaration does not declare anything
In file included from ./src/error.c:31:0:
./src/driver/usbdlib_gcc.h:206:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_Debug_LogEntry'
./src/driver/usbdlib_gcc.h:215:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_GetUSBDIVersion'
./src/driver/usbdlib_gcc.h:222:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_ParseConfigurationDescriptor'
./src/driver/usbdlib_gcc.h:230:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_CreateConfigurationRequest'
./src/driver/usbdlib_gcc.h:237:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_ParseDescriptors'
./src/driver/usbdlib_gcc.h:246:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_ParseConfigurationDescriptorEx'
./src/driver/usbdlib_gcc.h:258:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_CreateConfigurationRequestEx'
./src/driver/usbdlib_gcc.h:265:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_GetInterfaceLength'
./src/driver/usbdlib_gcc.h:272:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_RegisterHcFilter'
./src/driver/usbdlib_gcc.h:279:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_GetPdoRegistryParameter'
./src/driver/usbdlib_gcc.h:289:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_QueryBusTime'
./src/driver/usbdlib_gcc.h:296:5: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'USBD_CalculateUsbBandwidth'
make: [error.o] Error 1 (ignored)
gcc -o libusb0.sys abort_endpoint.o claim_interface.o clear_feature.o dispatch.o
get_configuration.o get_descriptor.o get_interface.o get_status.o ioctl.o libus
b_driver.o pnp.o release_interface.o reset_device.o reset_endpoint.o set_configu
ration.o set_descriptor.o set_feature.o set_interface.o transfer.o vendor_reques
t.o power.o driver_registry.o error.o libusb_driver_rc.o libusb0_drv.def -s -sh
ared -Wl,--entry,_driveren...@8 -nostartfiles -nostdlib -L. -lusbd -lntoskrnl -l
hal
gcc.exe: error.o: No such file or directory
make: [libusb0.sys] Error 1 (ignored)
--
Xiaofan
------------------------------------------------------------------------------
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful,
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance.
http://p.sf.net/sfu/dell-sfdev2dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public