On Wed, Sep 8, 2010 at 5:12 PM, Xiaofan Chen <[email protected]> wrote:
> On Wed, Sep 8, 2010 at 1:22 PM, Xiaofan Chen <[email protected]> wrote:
>> On Wed, Sep 8, 2010 at 1:16 PM, Ozkan Sezer <[email protected]> wrote:
>>
>>> See 
>>> http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/experimental/ddk_test/
>>> I'd say take
>>> http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/experimental/ddk_test/include/ddk/
>>> from there and put it into its exclusive directory like c:\ddk or 
>>> c:\mingw64\ddk
>>> or similar, and remove the one came with tdm64. And add this to your
>>> include path.
>>
>> Ok, I will try that.
>
> I get the svn ddk header and put it to src/ddk folder and modify the
> Makefile to point to it.
> Now I get tons of errors from winbase.h. There are many other errors,
> but the first one
> to solve seems to be winbase.h.
>
> 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./src/ddk -I.
> In file included from ./src/ddk/ntddk.h:38:0,
>                 from ./src/driver/libusb_driver.h:29,
>                 from ./src/driver/abort_endpoint.c:20:
> ./src/ddk/wdm.h:6669:36: warning: declaration does not declare anything
> In file included from
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/windows.h:63:0,
>                 from ./src/usb.h:5,
>                 from
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/usbdi.h:27,
>                 from ./src/driver/libusb_driver.h:31,
>                 from ./src/driver/abort_endpoint.c:20:
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:195:32:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'CRITICAL_SECTION'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:196:33:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'PCRITICAL_SECTION'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:197:33:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'LPCRITICAL_SECTION'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:198:38:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'CRITICAL_SECTION_DEBUG'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:199:39:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'PCRITICAL_SECTION_DEBUG'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:200:39:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before
> 'LPCRITICAL_SECTION_DEBUG'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1160:59:
> error: expected declaration specifiers or '...' before
> 'PMEMORY_BASIC_INFORMATION'
> In file included from
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/windows.h:63:0,
>                 from ./src/usb.h:5,
>                 from
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/usbdi.h:27,
>                 from ./src/driver/libusb_driver.h:31,
>                 from ./src/driver/abort_endpoint.c:20:
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1169:77:
> error: expected declaration specifiers or '...' before
> 'PMEMORY_BASIC_INFORMATION'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1210:66:
> error: expected declaration specifiers or '...' before
> 'HEAP_INFORMATION_CLASS'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1211:68:
> error: expected declaration specifiers or '...' before
> 'HEAP_INFORMATION_CLASS'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1366:71:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1367:66:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1368:66:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1369:86:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1370:74:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1371:72:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1372:67:
> error: expected ')' before 'lpCriticalSection'
> d:\tdm\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/../../../../x86_64-w64-mingw32/include/winbase.h:1619:59:
> error: expected ')' before 'lpCallback'
>
> ...
>
>
> --
> Xiaofan
>

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.

Cheers.

--
Ozkan

------------------------------------------------------------------------------
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