RE: [ctypes-users] Problems with ctypes code generation (h2xml & xml2py)
by Kuner Martin other posts by this author
Jul 12 2005 5:33AM messages near this date
RE: [ctypes-users] Problems with ctypes code generation (h2xml & xml2py)
|
RE: [ctypes-users] Problems with ctypes code generation (h2xml & xml2py)
Sorry, it does not work.
The definitions of the exported functions are still missing.
There are the "defines" and the defined types, but no functions.
D:\Projects\1.i60\ctype> xml2py.py win32atapi.xml -lD:\Projects\1.i60\ctype\win32atapi.dll -k
fdt
# generated by 'xml2py'
# flags 'win32atapi.xml -lD:\Projects\1.i60\ctype\win32atapi.dll -kfdt'
from ctypes import *
ERR_INVALID_PARAMETER = 50332416 # Variable c_ulong
ERR_UNKNOWN_MODE = 50332160 # Variable c_ulong
ERR_UNKNOWN_MODULE = 50331904 # Variable c_ulong
ERR_DLL_REENTRANT_TIMEOUT = 50331654 # Variable c_ulong
ERR_DLL_NOT_INITIALISED = 50331650 # Variable c_ulong
ERR_DLL_INIT_FAILED = 50331649 # Variable c_ulong
ERR_DLL_REENTRANT_OCCURRED = 50331653 # Variable c_ulong
ERR_INVALID_ATAPI_TIMEOUT = 50331655 # Variable c_ulong
BYTE = c_char
ERR_ATAPI_ALREADY_INITIALIZED = 50331651 # Variable c_ulong
DWORD = c_ulong
DLL_ERRLEVEL = 3 # Variable c_int
ERR_INVALID_BUFFER_PTR = 50331656 # Variable c_ulong
ERR_ATAPI_CMD_FAILED = 50331652 # Variable c_ulong
D:\Projects\1.i60\ctype>
The DLL is used, because if I enter an invalid DLL name, xml2py raises an error:
File "D:\Python24\Lib\site-packages\ctypes\__init__.py", line 319, in __init__
self._handle = _LoadLibrary(self._name)
WindowsError: [Errno 126] The specified module could not be found
I used the option -v and there´s an interesting info in it:
###########################
# Symbols defined:
#
# Variables: 12
# Struct/Unions: 0
# Functions: 0
# Enums: 0
# Enum values: 0
# Typedefs: 2
# Pointertypes: 0
# Arraytypes: 0
# unknown functions: 9
#
# Total symbols: 2
###########################
What means "unknown functions" ?
Thanks
Martin
-----Original Message-----
From: Thomas Heller [mailto:theller@[...].net]
Sent: Tuesday, 12. July 2005 11:28
To: Kuner Martin
Cc: Thomas Heller; ctypes-users@[...].net
Subject: Re: [ctypes-users] Problems with ctypes code generation (h2xml & xml2py)
"Kuner Martin" <martin.kuner@[...].net> writes:
> All files related to the code generattion are in one directory, and
> from that dir I started the tools h2xml and xml2py. There´s another
> strange behaviour: I have to copy the header file to be analyzed into
> the systems "temp" directory otherwise I´ll get an error message
> during the h2xml process (see below).
>
> D:\Projects\1.i60\ctype>h2xml.py win32atapi.h -o win32atapi.xml -c
> finding definitions ...
> running: gccxml --preprocess -dM d:\temp\tmprm4rns.cpp
> running: gccxml --preprocess -dM d:\temp\tmpsld_qv.cpp
> d:/temp/tmpsld_qv.cpp:1:24: win32atapi.h: No such file or directory 0
> found filtering definitions ...
> 0 values, 0 aliases
> finding definitions types ...
> running: gccxml d:\temp\tmpayd53r.cpp -fxml=d:\temp\tmprv315z.xml
> Compiler errors on these source lines:
> '#include "win32atapi.h"' win32atapi.h: No such file or directory
> CompilerError: gccxml returned 1
> D:\Projects\1.i60\ctype>
>
> So all files are in one dir, and I call the xml2py.py script from that directory.
> Do I need the actions you proposed additionaly ?
The current directory is in the search path, afaik, so I think you don't need to take these
actions.
For this error:
> '#include "win32atapi.h"' win32atapi.h: No such file or directory
gccxml by default searches include files in the C compiler's include directory. To find inc
lude files in the current directory, you must add '-I .' to the command line:
h2xml.py -I. win32atapi.h -o win32atapi.xml -c
plus the -l option for the dll.
Thomas
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
|