|
From: Ray S. <ra...@bl...> - 2006-09-11 20:09:18
|
If I don't use the -c for including #defines symbols libusb wraps OK! : >python C:\Python24\Lib\sitepackages\ctypes\wrap\h2xml.py usb.h -o usb.xml >python C:\Python24\Lib\site-packages\ctypes\wrap\xml2py.py usb.xml -l libusb0.dll -o usb.py -v -w ########################### # Symbols defined: # # Variables: 486 # Struct/Unions: 1188 # Functions: 3388 # Enums: 98 # Enum values: 592 # Typedefs: 3162 # Pointertypes: 1433 # Arraytypes: 96 # unknown functions: 1653 # # Total symbols: 9365 ########################### needed 1 loop(s) (still lots of "unknown functions" like function RpcMgmtBindingInqParameter not found in any dll function ltoa not found in any dll I had also uncommented line 537 in codegenerator.py Are these needed?) Using -c, still has problems/madness. Is the extra #define including useful here? It is a huge increase. Mainly, are these extra #define symbols really required for the Python wrapper? Using -c, I tried removing all #include lines from usb.h, no change. I then added the -w switch to have it search WIndows DLLs, which reduced the unresolved from 700+ to ~80: >C:\Python24\Lib\site-packages\ctypes\wrap\xml2py.py usb.xml -l libusb0.dll -o usb.py -v -w It is picking up these aliases from libusb0.dll itself, apparently. They have ASCII text references visible in the .dll, but the aliases do not appear to be in the libusb-win32-src files - I assume they are included from there, at some point? Can I just ignore these 80 unresolved aliases? Can I safely just exclude them with an h2xml.cfg? Will the Python wrapper "care" if they are? typical examples: VarUI4FromUI1 (in Oleaut32.lib ) QueryServiceConfig2A ( Advapi32.lib ) End of a typical verbose output: ... # unresolved alias: RpcNsEntryExpandName = RpcNsEntryExpandNameA # unresolved alias: WINGDIAPI = DECLSPEC_IMPORT ########################### # Symbols defined: # # Variables: 10243 # Struct/Unions: 1188 # Functions: 3388 # Enums: 98 # Enum values: 592 # Typedefs: 3162 # Pointertypes: 1433 # Arraytypes: 96 # unknown functions: 1655 # # Total symbols: 9365 ########################### needed 1 loop(s) I'll cross post to ctypes... Thanks, Ray At 10:14 AM 9/9/2006, RayS wrote: >Thanks Stephan, I'll give it another try Monday. > >Ray > >At 08:32 AM 9/9/2006, you wrote: >> > I just tried to wrap libusb0.dll with ctypes' codegenerator, >> > http://starship.python.net/crew/theller/ctypes/old/codegen.html >> > >python C:\Python24\Lib\site-packages\ctypes\wrap\h2xml.py usb.h >> -o usb.xml -c >> > OK >> > >C:\Python24\Lib\site-packages\ctypes\wrap\xml2py.py usb.xml -l >> libusb0.dll -o usb.py >> > which seems to go OK, mostly, but I get a zillion: >> > >> > # unresolved alias: AddPrintProcessor = AddPrintProcessorA >> > # unresolved alias: VarUI2FromInt = VarUI2FromI4 >> >>These are symbols exported by some of Windows' system DLLs. The errors >>might be caused by the fact that usb.h includes windows.h and stdlib.h. >>Try to remove these includes from the header before running the code >>generator. >> >> > ... >> > What extra header do I need to allow the script to resolve these >> references in the dll? >> >>You don't need any extra headers, just usb.h. > > > > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Libusb-win32-devel mailing list >Lib...@li... >https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel |