[Pyrex] compiler requires explicit cast?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jul 1 02:42:07 CEST 2009


horace wrote:

> i got it to compile by manually replacing this:
> 
> __pyx_t_2 = PyInt_FromLong(((long)LoadIcon(((void *)((long)__pyx_t_3)), 
> ((char *)1))));
> 
> with this:
> 
> __pyx_t_2 = 
> PyInt_FromLong(((long)LoadIcon(((HINSTANCE)((long)__pyx_t_3)), ((char 
> *)1))));

If the above two lines of C code aren't equivalent, then
HINSTANCE must be getting defined as something different
from void * from the C compiler's point of view.

At this point, if I were using gcc I would run it with
-M to find out what HINSTANCE is getting expanded into.
Not sure how to do that in a Windows environment, though.

BTW, it appears that you're actually using Cython, not Pyrex,
because

   cdef HMODULE h = GetModuleHandle(<char *>0)

is not valid Pyrex code. You may want to ask about this
on the Cython list. The code that Pyrex generates for
what you posted earlier is quite different (although it
probably wouldn't work any better in this situation).

-- 
Greg



More information about the Pyrex mailing list