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!



-- 
Xiaofan

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to