[Pyrex] warning C4047: '=' : 'PyObject *' differs in levels of indirection from 'FOO_STATUS'
Steve W. Hanawalt
Steve.Hanawalt at silabs.com
Wed Jun 9 22:40:40 CEST 2004
Hello,
I'm trying to create a python wrapper for a DLL, but I keep getting this
warning:
warning C4047: '=' : 'PyObject *' differs in levels of indirection from
'FOO_STATUS'
and I think it may be why the wrapper isn't working. When I execute the
code in Python I get:
SystemError: error return without exception set
Here as example snippet of the code:
foo.h:
#ifdef FOODLL_EXPORTS
#define FOODLL_API __declspec(dllexport)
#else
#define FOODLL_API __declspec(dllimport)
#endif
typedef int FOO_STATUS;
FOODLL_API
FOO_STATUS WINAPI FOO_GetNumDevices(
LPDWORD lpdwNumDevices
);
---end of example foo.h---
foo.pyx:
cdef extern from "stdafx.h":
ctypedef unsigned long DWORD
ctypedef unsigned short BOOL
ctypedef unsigned short BYTE
ctypedef unsigned short WORD
ctypedef float FLOAT
ctypedef FLOAT *PFLOAT
ctypedef BOOL *PBOOL
ctypedef BOOL *LPBOOL
ctypedef BYTE *PBYTE
ctypedef BYTE *LPBYTE
ctypedef int *PINT
ctypedef int *LPINT
ctypedef WORD *PWORD
ctypedef WORD *LPWORD
ctypedef long *LPLONG
ctypedef DWORD *PDWORD
ctypedef DWORD *LPDWORD
ctypedef void *LPVOID
ctypedef int INT
ctypedef unsigned int UINT
ctypedef unsigned int *PUINT
cdef extern from "FOO.h":
ctypedef int FOO_STATUS
FOO_STATUS
FOO_GetNumDevices(
LPDWORD lpdwNumDevices
)
def getNumDevices():
"""
This function returns the number of FOO devices connected to
the host.
"""
cdef FOO_STATUS status
cdef DWORD numDevs
status = FOO_GetNumDevices(&numDevs)
return numDevs
---end of example foo.pyx---
When I look at the C code generated by Pyrex, it's definitely trying to
assign an int to a pointer. Am I doing something wrong in the pyx file?
As a side question, is there an easier way to get the windows typedefs
without stating them explicitly?
Thanks in advance,
Steve
This email and any attachments thereto may contain private, confidential,
and privileged material for the sole use of the intended recipient. Any
review, copying, or distribution of this email (or any attachments thereto)
by others is strictly prohibited. If you are not the intended recipient,
please contact the sender immediately and permanently delete the original
and any copies of this email and any attachments thereto.
More information about the Pyrex
mailing list