Re: compiler requires explicit cast?

Greg Ewing <[email protected]> Wed, 01 Jul 2009 12:42:07 +1200
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
horace wrote:

> i got it to compile by manually replacing this:
> =

> __pyx_t_2 =3D PyInt_FromLong(((long)LoadIcon(((void *)((long)__pyx_t_3)), =

> ((char *)1))));
> =

> with this:
> =

> __pyx_t_2 =3D =

> 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 =3D 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